split: add a help entry to the final prompt
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 20 Feb 2018 09:36:55 +0100
changeset 4291 8f54ab5dd4e2
parent 4288 00bc03f56f37
child 4292 caaa89adf3eb
split: add a help entry to the final prompt We are about to add more option in this prompt. Adding a way to document then seems like a good first step.
hgext3rd/evolve/cmdrewrite.py
tests/test-evolve-obshistory-complex.t
tests/test-evolve-obshistory-lots-of-splits.t
tests/test-evolve-obshistory-split.t
tests/test-evolve-orphan-split.t
tests/test-evolve-templates.t
tests/test-prev-next.t
tests/test-rewind.t
tests/test-split.t
tests/test-topic-stack-complex.t
tests/test-topic-stack.t
--- a/hgext3rd/evolve/cmdrewrite.py	Tue Dec 04 13:33:51 2018 +0100
+++ b/hgext3rd/evolve/cmdrewrite.py	Tue Feb 20 09:36:55 2018 +0100
@@ -1203,10 +1203,21 @@
             # We should make dorecord return the newly created commit
             newcommits.append(repo['.'])
             if haschanges():
-                if ui.prompt('Done splitting? [yN]', default='n') == 'y':
-                    commands.commit(ui, repo, **opts)
-                    newcommits.append(repo['.'])
-                    break
+                nextaction = None
+                while nextaction is None:
+                    nextaction = ui.prompt('Done splitting? [yN?]', default='n')
+                    if nextaction == 'y':
+                        commands.commit(ui, repo, **opts)
+                        newcommits.append(repo['.'])
+                        break
+                    elif nextaction == '?':
+                        nextaction = None
+                        ui.write(_("y - yes, commit all remaining changes\n"))
+                        ui.write(_("n - no, continue selection\n"))
+                        ui.write(_("? - ?, display help\n"))
+                else:
+                    continue
+                break # propagate the previous break
             else:
                 ui.status(_("no more change to split\n"))
 
--- a/tests/test-evolve-obshistory-complex.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-evolve-obshistory-complex.t	Tue Feb 20 09:36:55 2018 +0100
@@ -164,7 +164,7 @@
   examine changes to 'B'? [Ynesfdaq?] N
   
   created new head
-  Done splitting? [yN] N
+  Done splitting? [yN?] N
   diff --git a/B b/B
   new file mode 100644
   examine changes to 'B'? [Ynesfdaq?] Y
@@ -198,7 +198,7 @@
   examine changes to 'D'? [Ynesfdaq?] N
   
   created new head
-  Done splitting? [yN] N
+  Done splitting? [yN?] N
   diff --git a/D b/D
   new file mode 100644
   examine changes to 'D'? [Ynesfdaq?] Y
@@ -233,7 +233,7 @@
   examine changes to 'F'? [Ynesfdaq?] N
   
   created new head
-  Done splitting? [yN] N
+  Done splitting? [yN?] N
   diff --git a/F b/F
   new file mode 100644
   examine changes to 'F'? [Ynesfdaq?] Y
--- a/tests/test-evolve-obshistory-lots-of-splits.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-evolve-obshistory-lots-of-splits.t	Tue Feb 20 09:36:55 2018 +0100
@@ -82,7 +82,7 @@
   examine changes to 'd'? [Ynesfdaq?] n
   
   created new head
-  Done splitting? [yN] n
+  Done splitting? [yN?] n
   diff --git a/b b/b
   new file mode 100644
   examine changes to 'b'? [Ynesfdaq?] y
@@ -99,7 +99,7 @@
   new file mode 100644
   examine changes to 'd'? [Ynesfdaq?] n
   
-  Done splitting? [yN] n
+  Done splitting? [yN?] n
   diff --git a/c b/c
   new file mode 100644
   examine changes to 'c'? [Ynesfdaq?] y
@@ -112,7 +112,7 @@
   new file mode 100644
   examine changes to 'd'? [Ynesfdaq?] n
   
-  Done splitting? [yN] n
+  Done splitting? [yN?] n
   diff --git a/d b/d
   new file mode 100644
   examine changes to 'd'? [Ynesfdaq?] y
--- a/tests/test-evolve-obshistory-split.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-evolve-obshistory-split.t	Tue Feb 20 09:36:55 2018 +0100
@@ -58,7 +58,7 @@
   examine changes to 'b'? [Ynesfdaq?] n
   
   created new head
-  Done splitting? [yN] n
+  Done splitting? [yN?] n
   diff --git a/b b/b
   new file mode 100644
   examine changes to 'b'? [Ynesfdaq?] y
--- a/tests/test-evolve-orphan-split.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-evolve-orphan-split.t	Tue Feb 20 09:36:55 2018 +0100
@@ -59,7 +59,7 @@
   examine changes to 'b'? [Ynesfdaq?] n
   
   created new head
-  Done splitting? [yN] y
+  Done splitting? [yN?] y
   1 new orphan changesets
 
   $ hg glog
@@ -152,7 +152,7 @@
   record change 3/3 to 'c'? [Ynesfdaq?] y
   
   created new head
-  Done splitting? [yN] y
+  Done splitting? [yN?] y
   1 new orphan changesets
 
   $ hg glog
--- a/tests/test-evolve-templates.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-evolve-templates.t	Tue Feb 20 09:36:55 2018 +0100
@@ -292,7 +292,7 @@
   examine changes to 'b'? [Ynesfdaq?] n
   
   created new head
-  Done splitting? [yN] n
+  Done splitting? [yN?] n
   diff --git a/b b/b
   new file mode 100644
   examine changes to 'b'? [Ynesfdaq?] y
--- a/tests/test-prev-next.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-prev-next.t	Tue Feb 20 09:36:55 2018 +0100
@@ -534,7 +534,7 @@
   examine changes to 'b'? [Ynesfdaq?] n
   
   created new head
-  Done splitting? [yN] N
+  Done splitting? [yN?] N
   diff --git a/b b/b
   new file mode 100644
   examine changes to 'b'? [Ynesfdaq?] y
--- a/tests/test-rewind.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-rewind.t	Tue Feb 20 09:36:55 2018 +0100
@@ -478,7 +478,7 @@
   examine changes to 'D'? [Ynesfdaq?] d
   
   created new head
-  Done splitting? [yN] y
+  Done splitting? [yN?] y
   $ hg log -G
   @  changeset:   5:9576e80d6851
   |  tag:         tip
--- a/tests/test-split.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-split.t	Tue Feb 20 09:36:55 2018 +0100
@@ -79,7 +79,7 @@
   record change 2/2 to '_d'? [Ynesfdaq?] n
   
   created new head
-  Done splitting? [yN] N
+  Done splitting? [yN?] N
   diff --git a/_d b/_d
   new file mode 100644
   examine changes to '_d'? [Ynesfdaq?] y
@@ -201,7 +201,7 @@
   record change 2/2 to '_c'? [Ynesfdaq?] n
   
   created new head
-  Done splitting? [yN] y
+  Done splitting? [yN?] y
   2 new orphan changesets
 
 Stop before splitting the commit completely creates a commit with all the
@@ -302,7 +302,7 @@
   examine changes to '_d'? [Ynesfdaq?] n
   
   created new head
-  Done splitting? [yN] y
+  Done splitting? [yN?] y
   $ hg log -G -r "3f134f739075::"
   @  changeset:   16:452a26648478
   |  bookmark:    bookA
@@ -454,7 +454,7 @@
   new file mode 100644
   examine changes to 'celeste'? [Ynesfdaq?] N
   
-  Done splitting? [yN] Y
+  Done splitting? [yN?] Y
   diff --git a/celeste b/celeste
   new file mode 100644
   examine changes to 'celeste'? [Ynesfdaq?] Y
@@ -551,7 +551,7 @@
   new file mode 100644
   examine changes to 'SPLIT2'? [Ynesfdaq?] N
   
-  Done splitting? [yN] N
+  Done splitting? [yN?] N
   diff --git a/SPLIT2 b/SPLIT2
   new file mode 100644
   examine changes to 'SPLIT2'? [Ynesfdaq?] Y
@@ -651,3 +651,53 @@
      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
+  > ?
+  > N
+  > 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
+  
+  Done splitting? [yN?] ?
+  y - yes, commit all remaining changes
+  n - no, continue selection
+  ? - ?, display help
+  Done splitting? [yN?] N
+  diff --git a/SPLIT4 b/SPLIT4
+  new file mode 100644
+  examine changes to 'SPLIT4'? [Ynesfdaq?] q
+  
+  transaction abort!
+  rollback completed
+  abort: user quit
+  [255]
--- a/tests/test-topic-stack-complex.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-topic-stack-complex.t	Tue Feb 20 09:36:55 2018 +0100
@@ -80,7 +80,7 @@
   new file mode 100644
   examine changes to 'd'? [Ynesfdaq?] n
   
-  Done splitting? [yN] y
+  Done splitting? [yN?] y
   1 new orphan changesets
 
   $ hg stack
--- a/tests/test-topic-stack.t	Tue Dec 04 13:33:51 2018 +0100
+++ b/tests/test-topic-stack.t	Tue Feb 20 09:36:55 2018 +0100
@@ -911,7 +911,7 @@
   new file mode 100644
   examine changes to 'ggg'? [Ynesfdaq?] n
   
-  Done splitting? [yN] y
+  Done splitting? [yN?] y
 
   $ hg --config extensions.evolve= obslog --all
   o  dde94df880e9 (21) c_G