how to revert update operation
Robert Collins
robertc at robertcollins.net
Wed Jul 19 01:25:34 BST 2006
On Tue, 2006-07-18 at 10:56 -0400, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> John Arbash Meinel wrote:
> > Aaron: can you comment? It seems like we are doing to 'merge' actions.
> > I'm wondering if the working tree is ever in an invalid state, or if we
> > are doing everything into limbo.
>
> I didn't write WorkingTree.update, and it kinda scares me.
>
> I'm not convinced that the rationale given for doing two merges is
> correct, but I'll have to think about it some more.
>
> It does do two merges. So I guess you'd be in an unexpected state if
> you aborted between the two merges, but it wouldn't be an /invalid/
> state, just not a correct one.
The reason it does two merges is to implement the standard behaviour of
'update'.
'update' in CVS and SVN does 'set your basis tree to the latest work on
the shared branch, merging your current work into the latest work'.
'update' with a lightweight checkout is trivially implementable as a
single merge. However, with the ability to do offline work, it needs a
slightly more complex description - or I thought it did :). You have 4
interesting trees: the master branch tip; the tip of your branch; the
last-revision of your working tree; the contents of your working tree.
In the pathologically trivial case, these are all the same. In the
pathologically complex case, the master branch tip is different to the
tip of your local work (because of uncommit on the master, or because of
--local work), the last-revision on the working tree is different to
your local branch tip (because of sftp pushes, or a local lightweight
checkout or ...), and you have uncommitted changes to the tree.
But the goal statement is still identical:
- set your basis to be the tip of the master
- turn all your local changes into a merge into the master
Which is why --local commits become a pending merge.
The double-merge call was the best approach I could figure out, but if
we can do better - cool.
For all its somewhat scary logic in there, it does the job beautifully
IMO :).
Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060719/6c14546e/attachment.pgp
More information about the bazaar
mailing list