comparison tests/test-import-bypass.t @ 15131:7c26ce9edbd2

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.)
author Greg Ward <greg@gerg.ca>
date Sun, 18 Sep 2011 19:59:33 -0400
parents adbf5e7df96d
children 59e8bc22506e
comparison
equal deleted inserted replaced
15130:3d44e68360a6 15131:7c26ce9edbd2
60 |/ 60 |/
61 @ 0:07f494440405 test 0 0 - default - adda 61 @ 0:07f494440405 test 0 0 - default - adda
62 62
63 $ hg rollback 63 $ hg rollback
64 repository tip rolled back to revision 1 (undo commit) 64 repository tip rolled back to revision 1 (undo commit)
65 working directory now based on revision 0
66 65
67 Test --import-branch 66 Test --import-branch
68 67
69 $ hg import --bypass --import-branch ../test.diff 68 $ hg import --bypass --import-branch ../test.diff
70 applying ../test.diff 69 applying ../test.diff
73 | 72 |
74 @ 0:07f494440405 test 0 0 - default - adda 73 @ 0:07f494440405 test 0 0 - default - adda
75 74
76 $ hg rollback 75 $ hg rollback
77 repository tip rolled back to revision 1 (undo commit) 76 repository tip rolled back to revision 1 (undo commit)
78 working directory now based on revision 0
79 77
80 Test --strip 78 Test --strip
81 79
82 $ hg import --bypass --strip 0 - <<EOF 80 $ hg import --bypass --strip 0 - <<EOF
83 > # HG changeset patch 81 > # HG changeset patch
96 > +a 94 > +a
97 > EOF 95 > EOF
98 applying patch from stdin 96 applying patch from stdin
99 $ hg rollback 97 $ hg rollback
100 repository tip rolled back to revision 1 (undo commit) 98 repository tip rolled back to revision 1 (undo commit)
101 working directory now based on revision 0
102 99
103 Test unsupported combinations 100 Test unsupported combinations
104 101
105 $ hg import --bypass --no-commit ../test.diff 102 $ hg import --bypass --no-commit ../test.diff
106 abort: cannot use --no-commit with --bypass 103 abort: cannot use --no-commit with --bypass