##// END OF EJS Templates
rollback: only restore dirstate and branch when appropriate....
rollback: only restore dirstate and branch when appropriate. If the working dir parent was destroyed by rollback, then the old behaviour is perfectly reasonable: restore dirstate, branch, and bookmarks. That way the working dir moves back to an existing changeset rather than becoming an orphan. But if the working dir parent was unaffected -- say, you updated to an older changeset and then did rollback -- then it's silly to restore dirstate and branch. So don't do that. Leave the status of the working dir alone. (But always restore bookmarks, because that file refers to changeset IDs that may have been destroyed.)

File last commit:

r15131:7c26ce9e default
r15131:7c26ce9e default
Show More
test-url-rev.t
203 lines | 4.1 KiB | text/troff | Tads3Lexer
Matt Mackall
tests: fix a bunch of pointless #s in unified tests
r12328 Test basic functionality of url#rev syntax
Adrian Buehlmann
tests: unify test-url-rev
r12300
$ hg init repo
$ cd repo
$ echo a > a
$ hg ci -qAm 'add a'
$ hg branch foo
marked working directory as branch foo
$ echo >> a
$ hg ci -m 'change a'
$ cd ..
$ hg clone 'repo#foo' clone
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 1 files
updating to branch foo
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd clone heads
changeset: 1:cd2a86ecc814
branch: foo
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: change a
changeset: 0:1f0dee641bb7
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add a
$ hg --cwd clone parents
changeset: 1:cd2a86ecc814
branch: foo
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: change a
$ cat clone/.hg/hgrc
[paths]
Mads Kiilerich
tests: remove redundant globs...
r12640 default = $TESTTMP/repo#foo
Adrian Buehlmann
tests: unify test-url-rev
r12300
Changing original repo:
$ cd repo
$ echo >> a
$ hg ci -m 'new head of branch foo'
$ hg up -qC default
$ echo bar > bar
$ hg ci -qAm 'add bar'
$ hg log
changeset: 3:4cd725637392
tag: tip
parent: 0:1f0dee641bb7
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add bar
changeset: 2:faba9097cad4
branch: foo
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: new head of branch foo
changeset: 1:cd2a86ecc814
branch: foo
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: change a
changeset: 0:1f0dee641bb7
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add a
$ hg -q outgoing '../clone#foo'
2:faba9097cad4
$ hg -q push '../clone#foo'
$ hg --cwd ../clone heads
changeset: 2:faba9097cad4
branch: foo
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: new head of branch foo
changeset: 0:1f0dee641bb7
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add a
$ cd ..
$ cd clone
$ hg rollback
Gilles Moris
rollback: clarifies the message about the reverted state (issue2628)...
r13446 repository tip rolled back to revision 1 (undo push)
Adrian Buehlmann
tests: unify test-url-rev
r12300
$ hg -q incoming
2:faba9097cad4
$ hg -q pull
$ hg heads
changeset: 2:faba9097cad4
branch: foo
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: new head of branch foo
changeset: 0:1f0dee641bb7
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add a
Pull should not have updated:
$ hg parents -q
1:cd2a86ecc814
Going back to the default branch:
$ hg up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg parents
changeset: 0:1f0dee641bb7
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add a
No new revs, no update:
$ hg pull -qu
$ hg parents -q
0:1f0dee641bb7
$ hg rollback
Gilles Moris
rollback: clarifies the message about the reverted state (issue2628)...
r13446 repository tip rolled back to revision 1 (undo pull)
Adrian Buehlmann
tests: unify test-url-rev
r12300
$ hg parents -q
0:1f0dee641bb7
Pull -u takes us back to branch foo:
$ hg pull -qu
$ hg parents
changeset: 2:faba9097cad4
branch: foo
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: new head of branch foo
$ hg rollback
Gilles Moris
rollback: clarifies the message about the reverted state (issue2628)...
r13446 repository tip rolled back to revision 1 (undo pull)
working directory now based on revision 0
Adrian Buehlmann
tests: unify test-url-rev
r12300
$ hg up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg parents -q
0:1f0dee641bb7
$ hg heads -q
1:cd2a86ecc814
0:1f0dee641bb7
$ hg pull -qur default default
$ hg parents
changeset: 3:4cd725637392
tag: tip
parent: 0:1f0dee641bb7
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add bar
$ hg heads
changeset: 3:4cd725637392
tag: tip
parent: 0:1f0dee641bb7
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add bar
changeset: 2:faba9097cad4
branch: foo
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: new head of branch foo