[MERGE] Avoid losing data when converting a local branch to a lightweight checkout

Aaron Bentley aaron at aaronbentley.com
Mon Apr 7 03:33:46 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Bennetts wrote:
> Aaron Bentley wrote:
>> +class UnsyncedBranches(BzrDirError):
>> +
>> +    _fmt = "'%(display_url)s' is not in sync with %(target_url)s"
>> +
>> +    def __init__(self, bzrdir, target_branch):
>> +        BzrDirError.__init__(self, bzrdir)
>> +        import bzrlib.urlutils as urlutils
>> +        self.target_url = urlutils.unescape_for_display(target_branch.base,
>> +                                                        'ascii')
>> +
> 
> I think ideally this would give the revnos or revids as well.  I guess the user
> can always investigate with "bzr log" or whatever, though.  So, up to you.

Nothing seem entirely satisfying.  We try to keep revision ids out of
the UI as much as humanly possible, but two branches could have the same
revno and different revision ids.


Note that status/commit also just say that the checkout is out-of-date,
without trying to describe how.

>> === modified file 'bzrlib/tests/test_reconfigure.py'
>> --- bzrlib/tests/test_reconfigure.py	2008-01-18 03:53:52 +0000
>> +++ bzrlib/tests/test_reconfigure.py	2008-04-06 16:54:35 +0000
>> @@ -203,6 +203,11 @@
>>          checkout.commit('test', rev_id='new-commit', local=True)
>>          reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
>>              checkout.bzrdir)
>> +        self.assertRaises(errors.UnsyncedBranches, reconfiguration.apply)
>> +        parent.pull(checkout.branch)
>> +        # work around pack fetch bug
>> +        checkout.commit('test2', local=True)
>> +        checkout.branch.set_last_revision_info(1, 'new-commit')
>>          reconfiguration.apply()
>>          wt = checkout.bzrdir.open_workingtree()
>>          self.assertTrue(parent.repository.has_same_location(
> 
> I don't follow this.  Why would the checkout be out of sync with the parent
> here?

new-commit was a local commit.  Once it is pulled into the parent
branch, they are no longer out of sync, and the reconfiguration succeeds.

>> @@ -215,7 +220,11 @@
>>          parent = self.make_branch('parent')
>>          child = parent.bzrdir.sprout('child').open_workingtree()
>>          child.commit('test', rev_id='new-commit')
>> +        parent.pull(child.branch)
>> +        # work around pack double-fetch bug
> 
> Is there a bug number for this?

Sure: 212926

I'll add it to the comments.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH+YgK0F+nu1YWqI0RAus0AJ9oLZZMsOAWuV5YenDxWeY/Zm4qHACffoD8
dPR+bVaVQ3u7i2mcOAMG7fI=
=Xz2P
-----END PGP SIGNATURE-----



More information about the bazaar mailing list