Mercurial > public > mercurial-scm > hg
diff tests/test-import.t @ 15198:62dc0e7ab092
import: wrap a transaction around the whole command
Now 'rollback' after 'import' is less surprising: it rolls back all of
the imported changesets, not just the last one. As an extra added
benefit, you don't need 'rollback -f' after 'import --bypass', which
was an undesired side effect of fixing issue2998 (59e8bc22506e)..
Note that this is a different take on issue963, which complained that
rollback after importing multiple patches returned the working dir
parent to the starting point, not to the second-last patch applied.
Since we now rollback the entire import, returning the working dir to
the starting point is entirely logical. So this change also undoes
a732eebf1958, the fix to issue963, and updates its tests accordingly.
Bottom line: rollback after import was weird before issue963,
understandable since the fix for issue963, and even better now.
author | Greg Ward <greg@gerg.ca> |
---|---|
date | Sun, 02 Oct 2011 14:34:28 -0400 |
parents | 0705f2ac79d6 |
children | 67e92d29ecb5 |
line wrap: on
line diff
--- a/tests/test-import.t Sat Oct 01 21:52:44 2011 -0400 +++ b/tests/test-import.t Sun Oct 02 14:34:28 2011 -0400 @@ -365,10 +365,10 @@ a created 6d019af21222 $ hg --cwd b rollback - repository tip rolled back to revision 1 (undo commit) - working directory now based on revision 1 + repository tip rolled back to revision 0 (undo import) + working directory now based on revision 0 $ hg --cwd b parents --template 'parent: {rev}\n' - parent: 1 + parent: 0 $ rm -r b @@ -688,6 +688,7 @@ adding a $ hg ci -m "commit" $ cat > a.patch <<EOF + > add a, b > diff --git a/a b/a > --- a/a > +++ b/a @@ -698,9 +699,25 @@ > EOF $ hg import --no-commit a.patch applying a.patch + +apply a good patch followed by an empty patch (mainly to ensure +that dirstate is *not* updated when import crashes) + $ hg update -q -C . + $ rm b + $ touch empty.patch + $ hg import a.patch empty.patch + applying a.patch + applying empty.patch + transaction abort! + rollback completed + abort: empty.patch: no diffs found + [255] + $ hg tip --template '{rev} {desc|firstline}\n' + 0 commit + $ hg -q status + M a $ cd .. - create file when source is not /dev/null $ cat > create.patch <<EOF