hgext3rd/evolve/cmdrewrite.py
changeset 4300 702f7e1d0b01
parent 4299 4af0235e7b0b
child 4340 5300be965515
--- a/hgext3rd/evolve/cmdrewrite.py	Wed Feb 21 14:39:48 2018 +0100
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Dec 13 17:40:41 2018 +0000
@@ -1132,7 +1132,8 @@
 
 @eh.command(
     'split',
-    [('r', 'rev', [], _("revision to split"), _('REV')),
+    [('i', 'interactive', True, _('use interactive mode')),
+     ('r', 'rev', [], _("revision to split"), _('REV')),
      ('n', 'note', '', _("store a note on split"), _('TEXT')),
     ] + commitopts + commitopts2 + commitopts3,
     _('hg split [OPTION] [-r REV] [FILES]'),
@@ -1153,6 +1154,7 @@
     _resolveoptions(ui, opts)
     tr = wlock = lock = None
     newcommits = []
+    iselect = opts.pop('interactive')
 
     revs = opts.get('rev') or '.'
     if not revs:
@@ -1212,11 +1214,19 @@
         while haschanges():
 
             if haschanges(matcher):
-                cmdutil.dorecord(ui, repo, commands.commit, 'commit', False,
-                                 cmdutil.recordfilter, *pats, **opts)
-                # TODO: Does no seem like the best way to do this
-                # We should make dorecord return the newly created commit
-                newcommits.append(repo['.'])
+                if iselect:
+                    cmdutil.dorecord(ui, repo, commands.commit, 'commit', False,
+                                     cmdutil.recordfilter, *pats, **opts)
+                    # TODO: Does no seem like the best way to do this
+                    # We should make dorecord return the newly created commit
+                    newcommits.append(repo['.'])
+                elif not pats:
+                    msg = _("no files of directories specified")
+                    hint = _("do you want --interactive")
+                    raise error.Abort(msg, hint=hint)
+                else:
+                    commands.commit(ui, repo, *pats, **opts)
+                    newcommits.append(repo['.'])
             if pats:
                 # refresh the wctx used for the matcher
                 matcher = scmutil.match(repo[None], pats)