Q: Ways to explain/teach revert vs. update?

Gordon Tyler gordon at doxxx.net
Wed May 18 18:57:44 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
On 5/18/2011 2:42 PM, Martitza Mendez wrote:
>
> I sometimes have difficulty explaining to people the behavior of
> 'update' after a 'revert'.
> I'm looking for advice which I don't think I'm finding in help or
> the user guide.
>
> Consider a standalone branch with a working tree.
> The branch is at revision 4 and the tree is up to date at revision 4.
> Now we revert the working tree to revision 2.
> Now if we 'update' we are told that the tree is up to date at
> revision 4. **This is the bit that some people have trouble
> understanding.**
> What they really need to do is revert to the head of the branch.
> But they wonder why update did not -- as the docs say -- "Update a
> tree to have the latest code committed to its branch"
>
> So what's a good story to teach to people to think correctly about this?
>

The summary help for update is perhaps too terse. In the longer help
for the update command, it says that it *merges* the changes in the
branch since the revision that the working tree currently reflects,
into the working tree and updates the working tree metadata to
indicate that it now reflects the latest revision.

So you can think of it has applying the diff for each revision to your
working tree since you last updated. If you use update to go back to
an old revision (update -r), it's essentially applying reverse diffs.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iQEcBAEBAgAGBQJN1BaoAAoJEIrPJfWinA2uyDYH/AvtSTUx0kMlYHM/MtkXO4+y
fN7rFpAKz3MWPYWs6Upal5CS6m3azYNpMzqL164g5OlPWND1CtWKOqK+hfnWI6J9
M+DQ45AxTCThXG3zgRAp/6cW+RucuDnABnH96jOO/8EqQ10Deno2chgTMLlobeIC
e/WNhrY8WLKa9SoDEleeq5jcZ+Fgu8iOXKHGHr4VaXDALeRoNNlJ+QetE7a6//jp
qVK1vFEWFzcUvOn6lHPevwq2F2LnW9UTi70VlTOFcRmzrTSuzEpH5GCbmWBM24nT
zLM1X2RsyPpn9uN7YfquZF3eXifQC4VQMQUck9qa6BpUIZRyLz9CuOb+IeMHjxw=
=FP2U
-----END PGP SIGNATURE-----




More information about the bazaar mailing list