# HG changeset patch # User Boris Feld # Date 1519213157 -3600 # Node ID a98fa6c0d4f305f28f2e557090f63749f815f705 # Parent b8cb1bdbc8d772c20b678d4642e16b9dd891a7ea split: only accept explicit revision through the `-r` option We are about to introduce new non-optionnal arguments to defines files patterns. To avoid confusion and to be closer to the standard options, only accepts revisions with the `-r` option. diff -r b8cb1bdbc8d7 -r a98fa6c0d4f3 CHANGELOG --- a/CHANGELOG Thu Dec 13 17:26:26 2018 +0100 +++ b/CHANGELOG Wed Feb 21 12:39:17 2018 +0100 @@ -6,6 +6,7 @@ * split: improve and update the user prompt (BC) * split: make it possible to drop change during a split + * split: no longer accept revision with --rev (BC) * push: have `--publish` overrule the `auto-publish` config * next: evolve aspiring children by default (use --no-evolve to skip) * next: pick lower part of a split as destination diff -r b8cb1bdbc8d7 -r a98fa6c0d4f3 hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Thu Dec 13 17:26:26 2018 +0100 +++ b/hgext3rd/evolve/cmdrewrite.py Wed Feb 21 12:39:17 2018 +0100 @@ -1135,9 +1135,9 @@ [('r', 'rev', [], _("revision to split"), _('REV')), ('n', 'note', '', _("store a note on split"), _('TEXT')), ] + commitopts + commitopts2 + commitopts3, - _('hg split [OPTION]... [-r] REV'), + _('hg split [OPTION]... [-r REV]'), helpbasic=True) -def cmdsplit(ui, repo, *revs, **opts): +def cmdsplit(ui, repo, **opts): """split a changeset into smaller changesets By default, split the current revision by prompting for all its hunks to be @@ -1150,11 +1150,15 @@ tr = wlock = lock = None newcommits = [] - revarg = (list(revs) + opts.get('rev')) or ['.'] - if len(revarg) != 1: - msg = _("more than one revset is given") - hnt = _("use either `hg split ` or `hg split --rev `, not both") - raise error.Abort(msg, hint=hnt) + revs = opts.get('rev') or '.' + if not revs: + revarg = '.' + elif len(revs) == 1: + revarg = revs[0] + else: + # XXX --rev often accept multiple value, it seems safer to explicitly + # complains here instead of just taking the last value. + raise error.Abort(_('more than one revset is given')) # Save the current branch to restore it in the end savedbranch = repo.dirstate.branch() @@ -1162,7 +1166,7 @@ try: wlock = repo.wlock() lock = repo.lock() - ctx = scmutil.revsingle(repo, revarg[0]) + ctx = scmutil.revsingle(repo, revarg) rev = ctx.rev() cmdutil.bailifchanged(repo) rewriteutil.precheck(repo, [rev], action='split') diff -r b8cb1bdbc8d7 -r a98fa6c0d4f3 tests/test-evolve-obshistory-complex.t --- a/tests/test-evolve-obshistory-complex.t Thu Dec 13 17:26:26 2018 +0100 +++ b/tests/test-evolve-obshistory-complex.t Wed Feb 21 12:39:17 2018 +0100 @@ -140,7 +140,7 @@ Then split ---------- - $ hg split "desc(fold0)" -d "0 0" << EOF + $ hg split --rev "desc(fold0)" -d "0 0" << EOF > Y > Y > N @@ -174,7 +174,7 @@ record this change to 'B'? [Ynesfdaq?] Y no more change to split - $ hg split "desc(fold1)" -d "0 0" << EOF + $ hg split --rev "desc(fold1)" -d "0 0" << EOF > Y > Y > N @@ -209,7 +209,7 @@ no more change to split 1 new orphan changesets - $ hg split "desc(fold2)" -d "0 0" << EOF + $ hg split --rev "desc(fold2)" -d "0 0" << EOF > Y > Y > N diff -r b8cb1bdbc8d7 -r a98fa6c0d4f3 tests/test-split.t --- a/tests/test-split.t Thu Dec 13 17:26:26 2018 +0100 +++ b/tests/test-split.t Wed Feb 21 12:39:17 2018 +0100 @@ -366,7 +366,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 +379,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 ` or `hg split --rev `, not both) [255] Split empty commit (issue5191)