Skip to content
Snippets Groups Projects
Commit 1896d6bc574b authored by Anton Shestakov's avatar Anton Shestakov
Browse files

split: demonstrate that discard after more than one commit is misbehaving

The `assert` that this patch removes was introduced in 9242d0b5f74d, when we
didn't have the test that this patch adds. Without the `assert` we can actually
see the incorrect behavior. With it, the test would throw an AssertionError
just before "forgetting c", when hg split is handling the second discard
action.
parent 9242d0b5f74d
No related branches found
No related tags found
No related merge requests found
......@@ -1314,7 +1314,6 @@
# hg <= 5.5 (8c466bcb0879)
if r'parents' in code.co_varnames[:code.co_argcount]:
args.append((target, node.nullid))
assert target.node() == repo.dirstate.p1()
if pats:
status = repo.status(match=matcher)
dirty = set()
......
......@@ -1285,3 +1285,103 @@
@@ -0,0 +1,1 @@
+a
$ cd ..
Discard after splitting into more than one changeset
$ hg init discard-after-many
$ cd discard-after-many
$ echo 0 > num
$ cat > editor.sh << '__EOF__'
> NUM=$(cat num)
> NUM=`expr "$NUM" + 1`
> echo "$NUM" > num
> echo "split$NUM" > "$1"
> __EOF__
$ export HGEDITOR="\"sh\" \"editor.sh\""
$ echo a > a
$ echo b > b
$ echo c > c
$ hg add a b c
$ hg ci -m 'a b c'
XXX: this shouldn't ask to re-examine changes in b and definitely shouldn't revert b
$ hg split << EOF
> f
> d
> y
> f
> d
> d
> s
> c
> EOF
0 files updated, 0 files merged, 3 files removed, 0 files unresolved
adding a
adding b
adding c
diff --git a/a b/a
new file mode 100644
examine changes to 'a'?
(enter ? for help) [Ynesfdaq?] f
diff --git a/b b/b
new file mode 100644
examine changes to 'b'?
(enter ? for help) [Ynesfdaq?] d
created new head
(consider using topic for lightweight branches. See 'hg help topic')
continue splitting? [Ycdq?] y
diff --git a/b b/b
new file mode 100644
examine changes to 'b'?
(enter ? for help) [Ynesfdaq?] f
diff --git a/c b/c
new file mode 100644
examine changes to 'c'?
(enter ? for help) [Ynesfdaq?] d
continue splitting? [Ycdq?] d
discarding remaining changes
forgetting c
removing b
diff --git a/b b/b
deleted file mode 100644
examine changes to 'b'?
(enter ? for help) [Ynesfdaq?] s
no changes to record
continue splitting? [Ycdq?] c
$ hg glog -p
@ 3:bdee57117c76 split3 (draft)
| diff --git a/b b/b
| deleted file mode 100644
| --- a/b
| +++ /dev/null
| @@ -1,1 +0,0 @@
| -b
|
o 2:c2c6f4d8c766 split2 (draft)
| diff --git a/b b/b
| new file mode 100644
| --- /dev/null
| +++ b/b
| @@ -0,0 +1,1 @@
| +b
|
o 1:fb91c6249a20 split1 (draft)
diff --git a/a b/a
new file mode 100644
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
+a
$ cd ..
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment