--- a/tests/test-split.t Tue Jan 22 10:43:44 2019 -0500
+++ b/tests/test-split.t Tue Jan 22 10:46:02 2019 -0500
@@ -4,6 +4,8 @@
$ . $TESTDIR/testlib/common.sh
$ cat >> $HGRCPATH <<EOF
+ > [alias]
+ > glog = log -G -T "{rev}:{node|short} {desc|firstline} ({phase})\n"
> [defaults]
> amend=-d "0 0"
> fold=-d "0 0"
@@ -55,7 +57,7 @@
> y
> y
> n
- > N
+ > Y
> y
> y
> EOF
@@ -79,7 +81,7 @@
record change 2/2 to '_d'? [Ynesfdaq?] n
created new head
- Done splitting? [yN] N
+ continue splitting? [Ycdq?] Y
diff --git a/_d b/_d
new file mode 100644
examine changes to '_d'? [Ynesfdaq?] y
@@ -179,7 +181,7 @@
> y
> y
> n
- > y
+ > c
> EOF
2 files updated, 0 files merged, 2 files removed, 0 files unresolved
reverting _b
@@ -201,7 +203,7 @@
record change 2/2 to '_c'? [Ynesfdaq?] n
created new head
- Done splitting? [yN] y
+ continue splitting? [Ycdq?] c
2 new orphan changesets
Stop before splitting the commit completely creates a commit with all the
@@ -281,7 +283,7 @@
> y
> y
> n
- > y
+ > c
> EOF
(leaving bookmark bookB)
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -302,7 +304,7 @@
examine changes to '_d'? [Ynesfdaq?] n
created new head
- Done splitting? [yN] y
+ continue splitting? [Ycdq?] c
$ hg log -G -r "3f134f739075::"
@ changeset: 16:452a26648478
| bookmark: bookA
@@ -366,7 +368,7 @@
[255]
Running split with tip revision, specified as unnamed argument
- $ hg split . << EOF
+ $ hg split --rev . << EOF
> q
> EOF
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -379,11 +381,10 @@
[255]
Running split with both unnamed and named revision arguments shows an error msg
- $ hg split . --rev .^ << EOF
+ $ hg split --rev . --rev .^ << EOF
> q
> EOF
abort: more than one revset is given
- (use either `hg split <rs>` or `hg split --rev <rs>`, not both)
[255]
Split empty commit (issue5191)
@@ -435,7 +436,7 @@
> Y
> Y
> N
- > Y
+ > c
> Y
> Y
> EOF
@@ -454,16 +455,7 @@
new file mode 100644
examine changes to 'celeste'? [Ynesfdaq?] N
- Done splitting? [yN] Y
- diff --git a/celeste b/celeste
- new file mode 100644
- examine changes to 'celeste'? [Ynesfdaq?] Y
-
- @@ -0,0 +1,1 @@
- +celeste
- record this change to 'celeste'? [Ynesfdaq?] Y
-
- no more change to split
+ continue splitting? [Ycdq?] c
Check that the topic is still here
@@ -537,7 +529,7 @@
$ hg split -r . << EOF
> Y
> N
- > N
+ > Y
> Y
> EOF
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
@@ -551,7 +543,7 @@
new file mode 100644
examine changes to 'SPLIT2'? [Ynesfdaq?] N
- Done splitting? [yN] N
+ continue splitting? [Ycdq?] Y
diff --git a/SPLIT2 b/SPLIT2
new file mode 100644
examine changes to 'SPLIT2'? [Ynesfdaq?] Y
@@ -651,3 +643,479 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: split10
+
+Check prompt options
+--------------------
+
+Look at the help (both record and split helps)
+
+ $ hg split -r tip << EOF
+ > Y
+ > ?
+ > d
+ > ?
+ > q
+ > EOF
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ adding SPLIT3
+ adding SPLIT4
+ diff --git a/SPLIT3 b/SPLIT3
+ new file mode 100644
+ examine changes to 'SPLIT3'? [Ynesfdaq?] Y
+
+ diff --git a/SPLIT4 b/SPLIT4
+ new file mode 100644
+ examine changes to 'SPLIT4'? [Ynesfdaq?] ?
+
+ y - yes, record this change
+ n - no, skip this change
+ e - edit this change manually
+ s - skip remaining changes to this file
+ f - record remaining changes to this file
+ d - done, skip remaining changes and files
+ a - record all changes to all remaining files
+ q - quit, recording no changes
+ ? - ? (display help)
+ examine changes to 'SPLIT4'? [Ynesfdaq?] d
+
+ continue splitting? [Ycdq?] ?
+ y - yes, continue selection
+ c - commit, select all remaining changes
+ d - discard, discard remaining changes
+ q - quit, abort the split
+ ? - ?, display help
+ continue splitting? [Ycdq?] q
+ transaction abort!
+ rollback completed
+ abort: user quit
+ [255]
+
+discard some of changeset during split
+
+ $ cat >> $HGRCPATH <<EOF
+ > [experimental]
+ > evolution=all
+ > evolutioncommands=
+ > EOF
+
+ $ hg export
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Branch another-branch
+ # Node ID 56a59faa8af70dc104faa905231731ffece5f18a
+ # Parent 75695e3e2300d316cc515c4c25bab8b825ef1433
+ # EXP-Topic mytopic
+ split10
+
+ diff --git a/SPLIT2 b/SPLIT2
+ new file mode 100644
+ $ hg add SPLIT3
+ $ hg amend
+ 1 new orphan changesets
+ $ hg export
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Branch another-branch
+ # Node ID 3acb634dc68ddb4dea75a9cee982955bc1f3e8cd
+ # Parent 75695e3e2300d316cc515c4c25bab8b825ef1433
+ # EXP-Topic mytopic
+ split10
+
+ diff --git a/SPLIT2 b/SPLIT2
+ new file mode 100644
+ diff --git a/SPLIT3 b/SPLIT3
+ new file mode 100644
+ $ hg split << EOF
+ > Y
+ > d
+ > d
+ > EOF
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ diff --git a/SPLIT2 b/SPLIT2
+ new file mode 100644
+ examine changes to 'SPLIT2'? [Ynesfdaq?] Y
+
+ diff --git a/SPLIT3 b/SPLIT3
+ new file mode 100644
+ examine changes to 'SPLIT3'? [Ynesfdaq?] d
+
+ continue splitting? [Ycdq?] d
+ discarding remaining changes
+ forgetting SPLIT3
+ $ hg export
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Branch another-branch
+ # Node ID db690d5566962489d65945c90b468b44e0b1507a
+ # Parent 75695e3e2300d316cc515c4c25bab8b825ef1433
+ # EXP-Topic mytopic
+ split12
+
+ diff --git a/SPLIT2 b/SPLIT2
+ new file mode 100644
+ $ hg status
+ ? SPLIT3
+ ? SPLIT4
+ ? editor.sh
+ ? num
+
+Test restricting the split to a subset of files
+-----------------------------------------------
+
+ $ hg add SPLIT3 SPLIT4
+ $ hg amend
+
+Only run on 2 files
+
+(remaining changes gathered with unmatched one)
+
+ $ hg split SPLIT2 SPLIT3 << EOF
+ > y
+ > n
+ > c
+ > EOF
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ adding SPLIT4
+ diff --git a/SPLIT2 b/SPLIT2
+ new file mode 100644
+ examine changes to 'SPLIT2'? [Ynesfdaq?] y
+
+ diff --git a/SPLIT3 b/SPLIT3
+ new file mode 100644
+ examine changes to 'SPLIT3'? [Ynesfdaq?] n
+
+ continue splitting? [Ycdq?] c
+ $ hg status --change '.~1'
+ A SPLIT2
+ $ hg status --change '.'
+ A SPLIT3
+ A SPLIT4
+ $ hg fold --from '.~1'
+ 2 changesets folded
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+(no remaining changes)
+
+ $ hg split SPLIT2 SPLIT3 << EOF
+ > y
+ > n
+ > y
+ > y
+ > EOF
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ adding SPLIT4
+ diff --git a/SPLIT2 b/SPLIT2
+ new file mode 100644
+ examine changes to 'SPLIT2'? [Ynesfdaq?] y
+
+ diff --git a/SPLIT3 b/SPLIT3
+ new file mode 100644
+ examine changes to 'SPLIT3'? [Ynesfdaq?] n
+
+ continue splitting? [Ycdq?] y
+ diff --git a/SPLIT3 b/SPLIT3
+ new file mode 100644
+ examine changes to 'SPLIT3'? [Ynesfdaq?] y
+
+ no more change to split
+ $ hg status --change '.~2'
+ A SPLIT2
+ $ hg status --change '.~1'
+ A SPLIT3
+ $ hg status --change '.'
+ A SPLIT4
+ $ hg fold --from '.~2'
+ 3 changesets folded
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+(only all matched selected)
+
+ $ hg split SPLIT2 SPLIT3 << EOF
+ > y
+ > y
+ > EOF
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ adding SPLIT4
+ diff --git a/SPLIT2 b/SPLIT2
+ new file mode 100644
+ examine changes to 'SPLIT2'? [Ynesfdaq?] y
+
+ diff --git a/SPLIT3 b/SPLIT3
+ new file mode 100644
+ examine changes to 'SPLIT3'? [Ynesfdaq?] y
+
+ no more change to split
+ $ hg status --change '.~1'
+ A SPLIT2
+ A SPLIT3
+ $ hg status --change '.'
+ A SPLIT4
+ $ hg fold --from '.~1'
+ 2 changesets folded
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Check that discard does not alter unmatched files
+
+ $ hg split SPLIT2 SPLIT3 << EOF
+ > y
+ > n
+ > d
+ > EOF
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ adding SPLIT4
+ diff --git a/SPLIT2 b/SPLIT2
+ new file mode 100644
+ examine changes to 'SPLIT2'? [Ynesfdaq?] y
+
+ diff --git a/SPLIT3 b/SPLIT3
+ new file mode 100644
+ examine changes to 'SPLIT3'? [Ynesfdaq?] n
+
+ continue splitting? [Ycdq?] d
+ discarding remaining changes
+ no more change to split
+ $ hg status --change '.~1'
+ A SPLIT2
+ $ hg status --change '.'
+ A SPLIT4
+ $ hg fold --from '.~1'
+ 2 changesets folded
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg add SPLIT3
+ $ hg amend
+
+Non interractive run
+--------------------
+
+No patterns
+
+ $ hg split --no-interactive
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ adding SPLIT4
+ abort: no files of directories specified
+ (do you want --interactive)
+ [255]
+
+Selecting unrelated file
+(should we abort?)
+
+ $ hg split --no-interactive SPLIT1
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ adding SPLIT4
+ no more change to split
+ $ hg status --change '.'
+ A SPLIT2
+ A SPLIT3
+ A SPLIT4
+
+Selecting one file
+
+ $ hg split --no-interactive SPLIT2
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ adding SPLIT4
+ no more change to split
+ $ hg status --change '.~1'
+ A SPLIT2
+ $ hg status --change '.'
+ A SPLIT3
+ A SPLIT4
+ $ hg fold --from '.~1'
+ 2 changesets folded
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Selecting two files
+
+ $ hg split --no-interactive SPLIT2 SPLIT3
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ adding SPLIT4
+ no more change to split
+ $ hg status --change '.~1'
+ A SPLIT2
+ A SPLIT3
+ $ hg status --change '.'
+ A SPLIT4
+ $ hg fold --from '.~1'
+ 2 changesets folded
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Selecting all files
+(should we abort?)
+
+ $ hg split --no-interactive .
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding SPLIT2
+ adding SPLIT3
+ adding SPLIT4
+ no more change to split
+ $ hg status --change '.'
+ A SPLIT2
+ A SPLIT3
+ A SPLIT4
+
+ $ cd ..
+
+Testing that `hg evolve` choose right destination after split && prune (issue5686)
+--------------------------------------------------------------------------------
+
+Prepare the repository:
+ $ hg init issue5686
+ $ cd issue5686
+ $ echo p > p
+ $ hg ci -Amp
+ adding p
+
+ $ for ch in a b; do echo $ch > $ch; done;
+ $ hg ci -Am "added a and b"
+ adding a
+ adding b
+ $ echo c > c
+ $ hg ci -Amc
+ adding c
+ $ hg glog
+ @ 2:ab6ca3ebca74 c (draft)
+ |
+ o 1:79f47e067e66 added a and b (draft)
+ |
+ o 0:a5a1faba8d26 p (draft)
+
+
+To create commits with the number of split
+ $ 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\""
+
+Splitting the revision 1 to SPLIT1 and SPLIT2 which contains file a and b resp:
+ $ hg split -r 1 <<EOF
+ > y
+ > y
+ > n
+ > y
+ > y
+ > y
+ > EOF
+ 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+ adding a
+ adding b
+ diff --git a/a b/a
+ new file mode 100644
+ examine changes to 'a'? [Ynesfdaq?] y
+
+ @@ -0,0 +1,1 @@
+ +a
+ record change 1/2 to 'a'? [Ynesfdaq?] y
+
+ diff --git a/b b/b
+ new file mode 100644
+ examine changes to 'b'? [Ynesfdaq?] n
+
+ 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'? [Ynesfdaq?] y
+
+ @@ -0,0 +1,1 @@
+ +b
+ record this change to 'b'? [Ynesfdaq?] y
+
+ no more change to split
+ 1 new orphan changesets
+
+ $ hg glog -p
+ @ 4:5cf253fa63fa split2 (draft)
+ | diff --git a/b b/b
+ | new file mode 100644
+ | --- /dev/null
+ | +++ b/b
+ | @@ -0,0 +1,1 @@
+ | +b
+ |
+ o 3:88437e073cd4 split1 (draft)
+ | diff --git a/a b/a
+ | new file mode 100644
+ | --- /dev/null
+ | +++ b/a
+ | @@ -0,0 +1,1 @@
+ | +a
+ |
+ | * 2:ab6ca3ebca74 c (draft)
+ | | diff --git a/c b/c
+ | | new file mode 100644
+ | | --- /dev/null
+ | | +++ b/c
+ | | @@ -0,0 +1,1 @@
+ | | +c
+ | |
+ | x 1:79f47e067e66 added a and b (draft)
+ |/ diff --git a/a b/a
+ | new file mode 100644
+ | --- /dev/null
+ | +++ b/a
+ | @@ -0,0 +1,1 @@
+ | +a
+ | diff --git a/b b/b
+ | new file mode 100644
+ | --- /dev/null
+ | +++ b/b
+ | @@ -0,0 +1,1 @@
+ | +b
+ |
+ o 0:a5a1faba8d26 p (draft)
+ diff --git a/p b/p
+ new file mode 100644
+ --- /dev/null
+ +++ b/p
+ @@ -0,0 +1,1 @@
+ +p
+
+Now if we prune revision 4 the expected destination of orphan cset 2 is 3. Lets
+check evolve does as expected:
+
+The fix is 4.9 only, so we simply cheat on older version
+
+Pruning revision 4 (current one):
+ $ hg prune .
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ working directory now at 88437e073cd4
+ 1 changesets pruned
+ $ hg rebase -r 2 -d 3 --config extensions.rebase=
+ rebasing 2:ab6ca3ebca74 "c"
+ $ hg up
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg glog
+ @ 5:21a63bd6ee88 c (draft)
+ |
+ o 3:88437e073cd4 split1 (draft)
+ |
+ o 0:a5a1faba8d26 p (draft)
+