diff tests/test-split.t @ 4300:702f7e1d0b01

split: add a --interactive flag While the interactive mode is useful for end-users, there are some cases where they don't need the interactivity overhead. Moreover, this allow the split command to be used in automated scripts.
author Boris Feld <boris.feld@octobus.net>
date Thu, 13 Dec 2018 17:40:41 +0000
parents 4af0235e7b0b
children f45b4c31d81f
line wrap: on
line diff
--- a/tests/test-split.t	Wed Feb 21 14:39:48 2018 +0100
+++ b/tests/test-split.t	Thu Dec 13 17:40:41 2018 +0000
@@ -897,3 +897,79 @@
   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