~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Vincent Ladeuil
  • Date: 2009-04-27 16:10:10 UTC
  • mto: (4310.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4311.
  • Revision ID: v.ladeuil+lp@free.fr-20090427161010-7swfzeagf63cpixd
Fix bug #367726 by reverting some default user handling introduced
while fixing bug #256612.

* bzrlib/transport/ssh.py:
(_paramiko_auth): Explicitly use getpass.getuser() as default
user.

* bzrlib/transport/ftp/_gssapi.py:
(GSSAPIFtpTransport._create_connection): Explicitly use
getpass.getuser() as default user.

* bzrlib/transport/ftp/__init__.py:
(FtpTransport._create_connection): Explicitly use
getpass.getuser() as default user.

* bzrlib/tests/test_sftp_transport.py:
(TestUsesAuthConfig.test_sftp_is_none_if_no_config)
(TestUsesAuthConfig.test_sftp_doesnt_prompt_username): Revert to
None as the default user.

* bzrlib/tests/test_remote.py:
(TestRemoteSSHTransportAuthentication): The really offending one:
revert to None as the default user.

* bzrlib/tests/test_config.py:
(TestAuthenticationConfig.test_username_default_no_prompt): Update
test (and some PEP8).

* bzrlib/smtp_connection.py:
(SMTPConnection._authenticate): Revert to None as the default
user.

* bzrlib/plugins/launchpad/account.py:
(_get_auth_user): Revert default value handling.

* bzrlib/config.py:
(AuthenticationConfig.get_user): Fix doc-string. Leave default
value handling to callers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
import bzrlib.branch
81
81
from bzrlib.transport import get_transport
82
82
import bzrlib.ui
83
 
from bzrlib.workingtree_4 import WorkingTreeFormat4, WorkingTreeFormat5
 
83
from bzrlib.workingtree_4 import (
 
84
    WorkingTreeFormat4,
 
85
    WorkingTreeFormat5,
 
86
    WorkingTreeFormat6,
 
87
    )
84
88
""")
85
89
 
86
90
from bzrlib import symbol_versioning
415
419
            return self.branch.repository.revision_tree(revision_id)
416
420
        except (errors.RevisionNotPresent, errors.NoSuchRevision):
417
421
            # the basis tree *may* be a ghost or a low level error may have
418
 
            # occured. If the revision is present, its a problem, if its not
 
422
            # occurred. If the revision is present, its a problem, if its not
419
423
            # its a ghost.
420
424
            if self.branch.repository.has_revision(revision_id):
421
425
                raise
557
561
 
558
562
        revision
559
563
            If not None, the cloned tree will have its last revision set to
560
 
            revision, and and difference between the source trees last revision
 
564
            revision, and difference between the source trees last revision
561
565
            and this one merged in.
562
566
        """
563
567
        # assumes the target bzr dir format is compatible.
969
973
        return file_id
970
974
 
971
975
    def get_symlink_target(self, file_id):
972
 
        return os.readlink(self.id2abspath(file_id).encode(osutils._fs_enc))
 
976
        return os.readlink(self.id2abspath(file_id).encode(osutils._fs_enc)
 
977
            ).decode(osutils._fs_enc)
973
978
 
974
979
    @needs_write_lock
975
980
    def subsume(self, other_tree):
1527
1532
        :raises: NoSuchId if any fileid is not currently versioned.
1528
1533
        """
1529
1534
        for file_id in file_ids:
 
1535
            if file_id not in self._inventory:
 
1536
                raise errors.NoSuchId(self, file_id)
 
1537
        for file_id in file_ids:
1530
1538
            if self._inventory.has_id(file_id):
1531
1539
                self._inventory.remove_recursive_id(file_id)
1532
 
            else:
1533
 
                raise errors.NoSuchId(self, file_id)
1534
1540
        if len(file_ids):
1535
1541
            # in the future this should just set a dirty bit to wait for the
1536
1542
            # final unlock. However, until all methods of workingtree start
1961
1967
                        tree_delta.unversioned.extend((unknown_file,))
1962
1968
                raise errors.BzrRemoveChangedFilesError(tree_delta)
1963
1969
 
1964
 
        # Build inv_delta and delete files where applicaple,
 
1970
        # Build inv_delta and delete files where applicable,
1965
1971
        # do this before any modifications to inventory.
1966
1972
        for f in files:
1967
1973
            fid = self.path2id(f)
2218
2224
            parent_trees = [(self.branch.last_revision(), to_tree)]
2219
2225
            merges = self.get_parent_ids()[1:]
2220
2226
            # Ideally we ask the tree for the trees here, that way the working
2221
 
            # tree can decide whether to give us teh entire tree or give us a
 
2227
            # tree can decide whether to give us the entire tree or give us a
2222
2228
            # lazy initialised tree. dirstate for instance will have the trees
2223
2229
            # in ram already, whereas a last-revision + basis-inventory tree
2224
2230
            # will not, but also does not need them when setting parents.
2980
2986
 
2981
2987
__default_format = WorkingTreeFormat4()
2982
2988
WorkingTreeFormat.register_format(__default_format)
 
2989
WorkingTreeFormat.register_format(WorkingTreeFormat6())
2983
2990
WorkingTreeFormat.register_format(WorkingTreeFormat5())
2984
2991
WorkingTreeFormat.register_format(WorkingTreeFormat3())
2985
2992
WorkingTreeFormat.set_default_format(__default_format)