rollback: clarifies the message about the reverted state (
issue2628)
Previously, when rolling back a transaction, some users could be confused
between the level to which the store is rolled back, and the new parents
of the working directory.
$ hg rollback
rolling back to revision 4 (undo commit)
With this change:
$ hg rollback
repository tip rolled back to tip revision 4 (undo commit)
working directory now based on revision 2 and 1
So now the user can realize that the store has been rolled back to an older
tip, but also that the working directory may not on the tip (here we are
rolling back the merge of the heads 2 and 1)
--- a/mercurial/localrepo.py Mon Feb 21 00:57:19 2011 +0100
+++ b/mercurial/localrepo.py Thu Feb 10 09:03:06 2011 +0100
@@ -713,11 +713,12 @@
try:
args = self.opener("undo.desc", "r").read().splitlines()
if len(args) >= 3 and self.ui.verbose:
- desc = _("rolling back to revision %s"
+ desc = _("repository tip rolled back to revision %s"
" (undo %s: %s)\n") % (
int(args[0]) - 1, args[1], args[2])
elif len(args) >= 2:
- desc = _("rolling back to revision %s (undo %s)\n") % (
+ desc = _("repository tip rolled back to revision %s"
+ " (undo %s)\n") % (
int(args[0]) - 1, args[1])
except IOError:
desc = _("rolling back unknown transaction\n")
@@ -740,6 +741,9 @@
self.invalidate()
self.dirstate.invalidate()
self.destroyed()
+ self.ui.status(_("working directory now based on "
+ "revision %s\n") % (
+ _(' and ').join(str(p.rev()) for p in self.parents())))
else:
self.ui.warn(_("no rollback information available\n"))
return 1
--- a/tests/test-acl.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-acl.t Thu Feb 10 09:03:06 2011 +0100
@@ -142,7 +142,8 @@
added 3 changesets with 3 changes to 3 files
updating the branch cache
checking for updated bookmarks
- rolling back to revision 0 (undo push)
+ repository tip rolled back to revision 0 (undo push)
+ working directory now based on revision 0
0:6675d58eff77
@@ -221,7 +222,8 @@
acl: changes have source "push" - skipping
updating the branch cache
checking for updated bookmarks
- rolling back to revision 0 (undo push)
+ repository tip rolled back to revision 0 (undo push)
+ working directory now based on revision 0
0:6675d58eff77
@@ -310,7 +312,8 @@
acl: allowing changeset 911600dab2ae
updating the branch cache
checking for updated bookmarks
- rolling back to revision 0 (undo push)
+ repository tip rolled back to revision 0 (undo push)
+ working directory now based on revision 0
0:6675d58eff77
@@ -945,7 +948,8 @@
acl: allowing changeset 911600dab2ae
updating the branch cache
checking for updated bookmarks
- rolling back to revision 0 (undo push)
+ repository tip rolled back to revision 0 (undo push)
+ working directory now based on revision 0
0:6675d58eff77
@@ -1341,7 +1345,8 @@
acl: allowing changeset 911600dab2ae
updating the branch cache
checking for updated bookmarks
- rolling back to revision 0 (undo push)
+ repository tip rolled back to revision 0 (undo push)
+ working directory now based on revision 0
0:6675d58eff77
@@ -1438,7 +1443,8 @@
acl: allowing changeset 911600dab2ae
updating the branch cache
checking for updated bookmarks
- rolling back to revision 0 (undo push)
+ repository tip rolled back to revision 0 (undo push)
+ working directory now based on revision 0
0:6675d58eff77
@@ -1628,7 +1634,8 @@
acl: allowing changeset 911600dab2ae
updating the branch cache
checking for updated bookmarks
- rolling back to revision 0 (undo push)
+ repository tip rolled back to revision 0 (undo push)
+ working directory now based on revision 0
0:6675d58eff77
--- a/tests/test-backout.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-backout.t Thu Feb 10 09:03:06 2011 +0100
@@ -204,7 +204,8 @@
changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e
$ hg rollback
- rolling back to revision 4 (undo commit)
+ repository tip rolled back to revision 4 (undo commit)
+ working directory now based on revision 4
$ hg update -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-bookmarks-strip.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-bookmarks-strip.t Thu Feb 10 09:03:06 2011 +0100
@@ -77,7 +77,8 @@
adding b
$ hg bookmarks markb
$ hg rollback
- rolling back to revision 0 (undo commit)
+ repository tip rolled back to revision 0 (undo commit)
+ working directory now based on revision 0
are you there?
--- a/tests/test-bundle-r.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-bundle-r.t Thu Feb 10 09:03:06 2011 +0100
@@ -200,7 +200,8 @@
checking files
4 files, 9 changesets, 7 total revisions
$ hg rollback
- rolling back to revision 4 (undo pull)
+ repository tip rolled back to revision 4 (undo pull)
+ working directory now based on revision -1
$ cd ..
should fail
@@ -276,7 +277,8 @@
checking files
4 files, 9 changesets, 7 total revisions
$ hg rollback
- rolling back to revision 2 (undo unbundle)
+ repository tip rolled back to revision 2 (undo unbundle)
+ working directory now based on revision 2
revision 2
@@ -300,7 +302,8 @@
checking files
2 files, 5 changesets, 5 total revisions
$ hg rollback
- rolling back to revision 2 (undo unbundle)
+ repository tip rolled back to revision 2 (undo unbundle)
+ working directory now based on revision 2
$ hg unbundle ../test-bundle-branch2.hg
adding changesets
adding manifests
@@ -319,7 +322,8 @@
checking files
3 files, 7 changesets, 6 total revisions
$ hg rollback
- rolling back to revision 2 (undo unbundle)
+ repository tip rolled back to revision 2 (undo unbundle)
+ working directory now based on revision 2
$ hg unbundle ../test-bundle-cset-7.hg
adding changesets
adding manifests
--- a/tests/test-bundle.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-bundle.t Thu Feb 10 09:03:06 2011 +0100
@@ -89,7 +89,8 @@
Rollback empty
$ hg -R empty rollback
- rolling back to revision -1 (undo pull)
+ repository tip rolled back to revision -1 (undo pull)
+ working directory now based on revision -1
Pull full.hg into empty again (using --cwd)
@@ -119,7 +120,8 @@
Rollback empty
$ hg -R empty rollback
- rolling back to revision -1 (undo pull)
+ repository tip rolled back to revision -1 (undo pull)
+ working directory now based on revision -1
Pull full.hg into empty again (using -R)
@@ -216,7 +218,8 @@
Rollback empty
$ hg rollback
- rolling back to revision -1 (undo pull)
+ repository tip rolled back to revision -1 (undo pull)
+ working directory now based on revision -1
$ cd ..
Log -R bundle:empty+full.hg
--- a/tests/test-convert-cvs.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-convert-cvs.t Thu Feb 10 09:03:06 2011 +0100
@@ -111,7 +111,8 @@
2 Initial revision
1 import
filtering out empty revision
- rolling back to revision 0 (undo commit)
+ repository tip rolled back to revision 0 (undo commit)
+ working directory now based on revision -1
0 ci0
updating tags
$ hgcat b/c
--- a/tests/test-diff-color.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-diff-color.t Thu Feb 10 09:03:06 2011 +0100
@@ -97,7 +97,8 @@
$ echo "[extensions]" >> $HGRCPATH
$ echo "mq=" >> $HGRCPATH
$ hg rollback
- rolling back to revision 0 (undo commit)
+ repository tip rolled back to revision 0 (undo commit)
+ working directory now based on revision 0
qrecord
--- a/tests/test-hook.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-hook.t Thu Feb 10 09:03:06 2011 +0100
@@ -221,7 +221,8 @@
added 1 changesets with 1 changes to 1 files
(run 'hg update' to get a working copy)
$ hg rollback
- rolling back to revision 3 (undo pull)
+ repository tip rolled back to revision 3 (undo pull)
+ working directory now based on revision 0
preoutgoing hook can prevent outgoing changes
--- a/tests/test-import.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-import.t Thu Feb 10 09:03:06 2011 +0100
@@ -364,7 +364,8 @@
applying ../patch2
applied 1d4bd90af0e4
$ hg --cwd b rollback
- rolling back to revision 1 (undo commit)
+ repository tip rolled back to revision 1 (undo commit)
+ working directory now based on revision 1
$ hg --cwd b parents --template 'parent: {rev}\n'
parent: 1
$ rm -r b
--- a/tests/test-keyword.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-keyword.t Thu Feb 10 09:03:06 2011 +0100
@@ -352,7 +352,8 @@
+bar
$ hg rollback
- rolling back to revision 2 (undo commit)
+ repository tip rolled back to revision 2 (undo commit)
+ working directory now based on revision 2
Record all chunks in file a
@@ -394,7 +395,8 @@
xxx $
bar
$ hg --verbose rollback
- rolling back to revision 2 (undo commit)
+ repository tip rolled back to revision 2 (undo commit)
+ working directory now based on revision 2
overwriting a expanding keywords
$ hg status a
M a
@@ -411,7 +413,8 @@
$ cat z
$Id: z,v 45a5d3adce53 1970/01/01 00:00:00 test $
$ hg --verbose rollback
- rolling back to revision 2 (undo commit)
+ repository tip rolled back to revision 2 (undo commit)
+ working directory now based on revision 2
overwriting z shrinking keywords
Only z should be overwritten
@@ -437,7 +440,8 @@
committed changeset 3:899491280810
overwriting r expanding keywords
$ hg --verbose rollback
- rolling back to revision 2 (undo commit)
+ repository tip rolled back to revision 2 (undo commit)
+ working directory now based on revision 2
overwriting r shrinking keywords
$ hg forget r
$ rm msg r
@@ -601,7 +605,8 @@
Status after rollback:
$ hg rollback
- rolling back to revision 1 (undo commit)
+ repository tip rolled back to revision 1 (undo commit)
+ working directory now based on revision 1
$ hg status
A c
$ hg update --clean
@@ -622,7 +627,8 @@
$ rm x
$ hg rollback
- rolling back to revision 1 (undo commit)
+ repository tip rolled back to revision 1 (undo commit)
+ working directory now based on revision 1
$ hg update --clean
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ rm i symignored
@@ -735,7 +741,8 @@
Rollback, revert, and check expansion
$ hg rollback
- rolling back to revision 2 (undo commit)
+ repository tip rolled back to revision 2 (undo commit)
+ working directory now based on revision 2
$ hg status
R a
? c
@@ -811,7 +818,8 @@
ignore $Id$
$ hg rollback
- rolling back to revision 2 (undo commit)
+ repository tip rolled back to revision 2 (undo commit)
+ working directory now based on revision 2
$ hg update --clean
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-newbranch.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-newbranch.t Thu Feb 10 09:03:06 2011 +0100
@@ -105,7 +105,8 @@
Test for invalid branch cache:
$ hg rollback
- rolling back to revision 4 (undo commit)
+ repository tip rolled back to revision 4 (undo commit)
+ working directory now based on revision 4 and 3
$ cp $branchcache .hg/bc-invalid
--- a/tests/test-notify.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-notify.t Thu Feb 10 09:03:06 2011 +0100
@@ -152,7 +152,8 @@
fail for config file is missing
$ hg --cwd b rollback
- rolling back to revision 0 (undo pull)
+ repository tip rolled back to revision 0 (undo pull)
+ working directory now based on revision 0
$ hg --cwd b pull ../a 2>&1 | grep 'error.*\.notify\.conf' > /dev/null && echo pull failed
pull failed
$ touch ".notify.conf"
@@ -160,7 +161,8 @@
pull
$ hg --cwd b rollback
- rolling back to revision 0 (undo pull)
+ repository tip rolled back to revision 0 (undo pull)
+ working directory now based on revision 0
$ hg --traceback --cwd b pull ../a | \
> python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
pulling from ../a
@@ -204,7 +206,8 @@
pull
$ hg --cwd b rollback
- rolling back to revision 0 (undo pull)
+ repository tip rolled back to revision 0 (undo pull)
+ working directory now based on revision 0
$ hg --traceback --cwd b pull ../a | \
> python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
pulling from ../a
--- a/tests/test-pull-r.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-pull-r.t Thu Feb 10 09:03:06 2011 +0100
@@ -42,7 +42,8 @@
$ hg -q parents
0:bbd179dfa0a7
$ hg rollback
- rolling back to revision -1 (undo pull)
+ repository tip rolled back to revision -1 (undo pull)
+ working directory now based on revision -1
$ hg pull -qr 0 ../repo
$ hg log
--- a/tests/test-pull.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-pull.t Thu Feb 10 09:03:06 2011 +0100
@@ -49,7 +49,7 @@
no changes found
$ hg rollback --dry-run --verbose
- rolling back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
+ repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
Issue622: hg init && hg pull -u URL doesn't checkout default branch
--- a/tests/test-push-http.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-push-http.t Thu Feb 10 09:03:06 2011 +0100
@@ -63,7 +63,8 @@
remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob)
% serve errors
$ hg rollback
- rolling back to revision 0 (undo serve)
+ repository tip rolled back to revision 0 (undo serve)
+ working directory now based on revision 0
expect authorization error: all users denied
--- a/tests/test-rename-after-merge.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-rename-after-merge.t Thu Feb 10 09:03:06 2011 +0100
@@ -97,7 +97,8 @@
copies: c2 (c1)
$ hg rollback
- rolling back to revision 2 (undo commit)
+ repository tip rolled back to revision 2 (undo commit)
+ working directory now based on revision 2 and 1
$ hg up -C .
2 files updated, 0 files merged, 2 files removed, 0 files unresolved
--- a/tests/test-rollback.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-rollback.t Thu Feb 10 09:03:06 2011 +0100
@@ -20,7 +20,8 @@
$ hg status
$ hg rollback
- rolling back to revision -1 (undo commit)
+ repository tip rolled back to revision -1 (undo commit)
+ working directory now based on revision -1
$ hg verify
checking changesets
checking manifests
@@ -37,7 +38,8 @@
$ hg branch test
marked working directory as branch test
$ hg rollback
- rolling back to revision -1 (undo commit)
+ repository tip rolled back to revision -1 (undo commit)
+ working directory now based on revision -1
$ hg branch
default
@@ -54,8 +56,9 @@
marked working directory as branch test
$ rm .hg/undo.branch
$ hg rollback
- rolling back to revision -1 (undo commit)
+ repository tip rolled back to revision -1 (undo commit)
Named branch could not be reset, current branch still is: test
+ working directory now based on revision -1
$ hg branch
test
--- a/tests/test-tag.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-tag.t Thu Feb 10 09:03:06 2011 +0100
@@ -227,7 +227,8 @@
$ hg tag hgtags-modified
$ hg rollback
- rolling back to revision 13 (undo commit)
+ repository tip rolled back to revision 13 (undo commit)
+ working directory now based on revision 13
$ hg st
M .hgtags
? .hgtags.orig
--- a/tests/test-tags.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-tags.t Thu Feb 10 09:03:06 2011 +0100
@@ -265,7 +265,8 @@
Undo a tag with rollback:
$ hg rollback # destroy rev 5 (restore bar)
- rolling back to revision 4 (undo commit)
+ repository tip rolled back to revision 4 (undo commit)
+ working directory now based on revision 4
$ hg tags
tip 4:0c192d7d5e6b
bar 1:78391a272241
--- a/tests/test-url-rev.t Mon Feb 21 00:57:19 2011 +0100
+++ b/tests/test-url-rev.t Thu Feb 10 09:03:06 2011 +0100
@@ -101,7 +101,8 @@
$ cd clone
$ hg rollback
- rolling back to revision 1 (undo push)
+ repository tip rolled back to revision 1 (undo push)
+ working directory now based on revision 1
$ hg -q incoming
2:faba9097cad4
@@ -145,7 +146,8 @@
0:1f0dee641bb7
$ hg rollback
- rolling back to revision 1 (undo pull)
+ repository tip rolled back to revision 1 (undo pull)
+ working directory now based on revision 1
$ hg up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -166,7 +168,8 @@
summary: new head of branch foo
$ hg rollback
- rolling back to revision 1 (undo pull)
+ repository tip rolled back to revision 1 (undo pull)
+ working directory now based on revision 0
$ hg up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved