rdamazio created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
The majority of split invocations only want to split a revision in two,
so this allows them to do that without getting a second chunk selector.
I thought of making a generic "max_splits" flag, but that seemed like
overkill.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D8064
AFFECTED FILES
hgext/split.py
tests/test-split.t
CHANGE DETAILS
diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -976,3 +976,60 @@
2
3
4
+
+Test doing single splits, where it doesn't prompt to inspect what's left after
+the first split.
+--
+
+ $ hg init $TESTTMP/splitsingle
+ $ cd $TESTTMP/splitsingle
+ $ printf '1\n2\n' > file
+ $ hg ci -qAm initial
+ $ printf '0\n1\n2\n3\n' > file
+ $ hg ci -qm splitme
+ $ cat > $TESTTMP/messages < split1
+ > --
+ > split2
+ > EOF
+ $ printf 'y\ny\nn\n' | hg split --single
+ diff --git a/file b/file
+ 2 hunks, 2 lines changed
+ examine changes to 'file'?
+ (enter ? for help) [Ynesfdaq?] y
+
+ @@ -0,0 +1,1 @@
+ +0
+ record change 1/2 to 'file'?
+ (enter ? for help) [Ynesfdaq?] y
+
+ @@ -2,0 +4,1 @@ 2
+ +3
+ record change 2/2 to 'file'?
+ (enter ? for help) [Ynesfdaq?] n
+
+ EDITOR: HG: Splitting 82efe286d133. Write commit message for the first split
changeset.
+ EDITOR: splitme
+ EDITOR:
+ EDITOR:
+ EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
+ EDITOR: HG: Leave message empty to abort commit.
+ EDITOR: HG: --
+ EDITOR: HG: user: test
+ EDITOR: HG: branch 'default'
+ EDITOR: HG: changed file
+ created new head
+ EDITOR: HG: Splitting 82efe286d133. So far it has been split into:
+ EDITOR: HG: - 810358029ce5: split1
+ EDITOR: HG: Write commit message for the next split changeset.
+ EDITOR: splitme
+ EDITOR:
+ EDITOR:
+ EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
+ EDITOR: HG: Leave message empty to abort commit.
+ EDITOR: HG: --
+ EDITOR: HG: user: test
+ EDITOR: HG: branch 'default'
+ EDITOR: HG: changed file
+ saved backup bundle to
$TESTTMP/splitsingle/.hg/strip-backup/82efe286d133-1ff8b354-split.hg
(obsstore-off !)
+
diff --git a/hgext/split.py b/hgext/split.py
--- a/hgext/split.py
+++ b/hgext/split.py
@@ -47,6 +47,7 @@
[
(b'r', b'rev', b'', _(b"revision to split"), _(b'REV')),
(b'', b'rebase', True, _(b'rebase descendants after split')),
+(b'', b'single', False, _(b'make a single split')),
]
+ cmdutil.commitopts2,
_(b'hg split [--no-rebase] [[-r] REV]'),
@@ -137,8 +138,13 @@
return any((st.modified, st.added, st.removed, st.deleted))
# Main split loop
+opts.update({b'edit': True, b'interactive': True})
while incomplete(repo):
if committed:
+if opts[b'single']:
+# Will make this take all changes and be the last split.
+del opts[b'interactive']
+
header = _(
b'HG: Splitting %s. So far it has been split into:\n'
) % short(ctx.node())
@@ -153,13 +159,8 @@
b'HG: Splitting %s. Write commit message for the '
b'first split changeset.\n'
) % short(ctx.node())
-opts.update(
-{
-b'edit': True,
-b'interactive': True,
-b'message': header + ctx.description(),
-}
-)
+
+opts.update({b'message': header + ctx.description()})
commands.commit(ui, repo, **pycompat.strkwargs(opts))
newctx = repo[b'.']
committed.append(newctx)
To: rdamazio, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel