Trouble with "bind/update"

John Arbash Meinel john at arbash-meinel.com
Mon Apr 21 18:56:26 BST 2008


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

Torsten Bronger wrote:
> Hallöchen!
> 
> I lost a big part of yesterday's work due to my own erroneous use of
> "bind".  Because I think that others *might* do the same mistake, I
> report here what happened.
> 
> I had an old version of my branch pushed to Launchpad, and had
> commited some further revisions locally.  In order to work more
> safely (*cough*), I wanted to switch to an SVN-like development with
> "bzr bind".
> 
> However, then the next commit failed and told me to do an update.  I
> did, and it reported me a lot of changes to my working tree.  I
> didn't like that and said "revert".  Stupid me.

Your changes are still present in the local repository. There is a
plugin (I think it is part of bzrtools) which provides a 'bzr heads'
command to find unreferenced heads. You should be able to use that to
recover your changes. (once you found the revision id, you should be
able to 'bzr pull -r revid:XXX' or 'bzr merge -r revid:XXX' if you have
other commits in the mean time.)

> 
> Now I wonder whether it makes sense if Bazaar tried to push/pull
> first before the "bind" is actually executed, or rejects a "bind" if
> the local branch is further developed, or something in this
> direction.

The original 'bzr bind' implementation did indeed do that. And then it
downgraded to only looking for divergence, and now it just sets the
bound property.

I believe the argument is that because you can 'bzr commit --local' you
can have your branches out of sync if they are bound or not. So we
shouldn't refuse to bind just because they are out of sync. Instead you
can get your branch into the bound state, so you can work with it in
terms of 'update' rather than push/pull.

The other limitations of our api at the moment is that there isn't a
trivial command to push your local changes to the master branch. bzr
update puts you at the master's tip, and 'bzr push' doesn't default to
chosing the master location. You can always 'bzr push
bzr+ssh://path/to/master/branch' but you have to type the path explicitly.

> 
> By the way, the "revert" didn't leave any foo.bar.~123~ files in my
> directories.

That is because it was shown as a clean merge. (The files would be the
same if you did 'bzr revert; bzr merge -r revid:XXXX'.) So it looked the
same as if you had merged someone else's code (didn't change anything)
and then changed your mind and did 'bzr revert'.

> 
> Tschö,
> Torsten.
> 

I agree there are some limitations, however after the 'update' it should
have told you:
  Your local commits will now show as pending merges with 'bzr status',
  and can be committed with 'bzr commit'.

If you have suggestions about how we could convey that better, we would
be happy to hear them.

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

iD8DBQFIDNVKJdeBCYSNAAMRAq/CAJ9VtmDvihMS+thyhdNOgeBG0tx71ACgyxf7
ip+BPBysYpgXjrkqSg1wYqc=
=3Hni
-----END PGP SIGNATURE-----



More information about the bazaar mailing list