amend: removing redundant commitfunc parameter in amend wrappers

Summary: cmdutil.amend was recently changed and the commitfunc parameter was
removed. This commit fixes the wrappers on the amend function by removing the
redundant parameter.

Test Plan: Ran the existing test suite
This commit is contained in:
Saurabh Singh 2017-09-08 10:07:41 -07:00
parent a6ec1d2188
commit a995eb2fd1
3 changed files with 6 additions and 35 deletions

View File

@ -132,7 +132,7 @@ def _runcommand(orig, lui, repo, cmd, fullargs, ui, *args, **kwargs):
False, "--tracecopies")
return orig(lui, repo, cmd, fullargs, ui, *args, **kwargs)
def _amend(orig, ui, repo, commitfunc, old, extra, pats, opts):
def _amend(orig, ui, repo, old, extra, pats, opts):
"""Wraps amend to collect copytrace data on amend
If a file is created in one commit, modified in a subsequent commit, and
@ -158,7 +158,7 @@ def _amend(orig, ui, repo, commitfunc, old, extra, pats, opts):
# Check if amend copytracing has been disabled.
if not ui.configbool("copytrace", "enableamendcopytrace", True):
return orig(ui, repo, commitfunc, old, extra, pats, opts)
return orig(ui, repo, old, extra, pats, opts)
# Need to get the amend-copies before calling the command because files from
# the working copy will be used during the amend.
@ -169,7 +169,7 @@ def _amend(orig, ui, repo, commitfunc, old, extra, pats, opts):
amend_copies = copiesmod.pathcopies(old, wctx, matcher)
# Finally, invoke the command.
node = orig(ui, repo, commitfunc, old, extra, pats, opts)
node = orig(ui, repo, old, extra, pats, opts)
amended_ctx = repo[node]
# Store the amend-copies against the amended context.

View File

@ -126,7 +126,7 @@ def _updateworkingcopy(repo, matcher):
return mirroredfiles
def _amend(orig, ui, repo, commitfunc, old, extra, pats, opts):
def _amend(orig, ui, repo, old, extra, pats, opts):
# Only wrap if not disabled and repo is instance of
# localrepo.localrepository
if _disabled[0] or not isinstance(repo, localrepo.localrepository):
@ -150,7 +150,7 @@ def _amend(orig, ui, repo, commitfunc, old, extra, pats, opts):
opts['include'] = [
f for f in wctx.files() if matcher(f)] + list(mirroredfiles)
return orig(ui, repo, commitfunc, old, extra, pats, opts)
return orig(ui, repo, old, extra, pats, opts)
def _commit(orig, self, *args, **kwargs):
if _disabled[0]:

View File

@ -223,44 +223,15 @@ def amend(ui, repo, *pats, **opts):
if not opts.get('noeditmessage') and not opts.get('message'):
opts['message'] = old.description()
tempnode = []
commitdate = opts.get('date')
if not commitdate:
if ui.config('fbamend', 'date') == 'implicitupdate':
commitdate = 'now'
else:
commitdate = old.date()
commituser = old.user() if not opts.get('user') else opts.get('user')
def commitfunc(ui, repo, message, match, opts):
e = cmdutil.commiteditor
noderesult = repo.commit(message,
commituser,
commitdate,
match,
editor=e,
extra={})
# the temporary commit is the very first commit
if not tempnode:
tempnode.append(noderesult)
return noderesult
active = bmactive(repo)
oldbookmarks = old.bookmarks()
if haschildren:
def fakestrip(orig, ui, repo, *args, **kwargs):
if tempnode:
if tempnode[0]:
# don't strip everything, just the temp node
# this is very hacky
orig(ui, repo, tempnode[0], backup='none')
tempnode.pop()
else:
orig(ui, repo, *args, **kwargs)
extensions.wrapfunction(repair, 'strip', fakestrip)
tr = None
wlock = None
lock = None
@ -276,7 +247,7 @@ def amend(ui, repo, *pats, **opts):
return
else:
node = cmdutil.amend(ui, repo, commitfunc, old, {}, pats, opts)
node = cmdutil.amend(ui, repo, old, {}, pats, opts)
if node == old.node():
ui.status(_("nothing changed\n"))