hgext/absorb.py
changeset 38923 8460c3cbca7e
parent 38922 ec0697f4f9c9
child 38932 205efbf656c2
--- a/hgext/absorb.py	Wed Aug 01 18:30:10 2018 -0400
+++ b/hgext/absorb.py	Tue Jul 31 11:29:25 2018 -0400
@@ -41,7 +41,6 @@
     context,
     crecord,
     error,
-    extensions,
     linelog,
     mdiff,
     node,
@@ -976,73 +975,3 @@
     state = absorb(ui, repo, pats=pats, opts=opts)
     if sum(s[0] for s in state.chunkstats.values()) == 0:
         return 1
-
-def _wrapamend(flag):
-    """add flag to amend, which will be a shortcut to the absorb command"""
-    if not flag:
-        return
-    amendcmd = extensions.bind(_amendcmd, flag)
-    # the amend command can exist in evolve, or fbamend
-    for extname in ['evolve', 'fbamend', None]:
-        try:
-            if extname is None:
-                cmdtable = commands.table
-            else:
-                ext = extensions.find(extname)
-                cmdtable = ext.cmdtable
-        except (KeyError, AttributeError):
-            continue
-        try:
-            entry = extensions.wrapcommand(cmdtable, 'amend', amendcmd)
-            options = entry[1]
-            msg = _('incorporate corrections into stack. '
-                    'see \'hg help absorb\' for details')
-            options.append(('', flag, None, msg))
-            return
-        except error.UnknownCommand:
-            pass
-
-def _amendcmd(flag, orig, ui, repo, *pats, **opts):
-    if not opts.get(flag):
-        return orig(ui, repo, *pats, **opts)
-    # use absorb
-    for k, v in opts.iteritems(): # check unsupported flags
-        if v and k not in ['interactive', flag]:
-            raise error.Abort(_('--%s does not support --%s')
-                              % (flag, k.replace('_', '-')))
-    state = absorb(ui, repo, pats=pats, opts=opts)
-    # different from the original absorb, tell users what chunks were
-    # ignored and were left. it's because users usually expect "amend" to
-    # take all of their changes and will feel strange otherwise.
-    # the original "absorb" command faces more-advanced users knowing
-    # what's going on and is less verbose.
-    adoptedsum = 0
-    messages = []
-    for path, (adopted, total) in state.chunkstats.iteritems():
-        adoptedsum += adopted
-        if adopted == total:
-            continue
-        reason = _('%d modified chunks were ignored') % (total - adopted)
-        messages.append(('M', 'modified', path, reason))
-    for idx, word, symbol in [(0, 'modified', 'M'), (1, 'added', 'A'),
-                              (2, 'removed', 'R'), (3, 'deleted', '!')]:
-        paths = set(state.status[idx]) - set(state.paths)
-        for path in sorted(paths):
-            if word == 'modified':
-                reason = _('unsupported file type (ex. binary or link)')
-            else:
-                reason = _('%s files were ignored') % word
-            messages.append((symbol, word, path, reason))
-    if messages:
-        ui.write(_('\n# changes not applied and left in '
-                   'working directory:\n'))
-        for symbol, word, path, reason in messages:
-            ui.write(_('# %s %s : %s\n') % (
-                ui.label(symbol, 'status.' + word),
-                ui.label(path, 'status.' + word), reason))
-
-    if adoptedsum == 0:
-        return 1
-
-def extsetup(ui):
-    _wrapamend(ui.config('absorb', 'amendflag'))