match: stop passing files through commitfunc

This commit is contained in:
Matt Mackall 2008-05-12 11:37:08 -05:00
parent 64da84d707
commit 6f8150b03d
3 changed files with 12 additions and 11 deletions

View File

@ -389,7 +389,7 @@ def dorecord(ui, repo, committer, *pats, **opts):
if not ui.interactive:
raise util.Abort(_('running non-interactively, use commit instead'))
def recordfunc(ui, repo, files, message, match, opts):
def recordfunc(ui, repo, message, match, opts):
"""This is generic record driver.
It's job is to interactively filter local changes, and accordingly
@ -402,15 +402,15 @@ def dorecord(ui, repo, committer, *pats, **opts):
In the end we'll record intresting changes, and everything else will be
left in place, so the user can continue his work.
"""
if files:
if match.files():
changes = None
else:
changes = repo.status(files=files, match=match)[:5]
changes = repo.status(match=match)[:5]
modified, added, removed = changes[:3]
files = modified + added + removed
match = cmdutil.matchfiles(repo, modified + added + removed)
diffopts = mdiff.diffopts(git=True, nodates=True)
fp = cStringIO.StringIO()
patch.diff(repo, repo.dirstate.parents()[0], files=files,
patch.diff(repo, repo.dirstate.parents()[0], files=match.files(),
match=match, changes=changes, opts=diffopts, fp=fp)
fp.seek(0)
@ -423,14 +423,15 @@ def dorecord(ui, repo, committer, *pats, **opts):
try: contenders.update(dict.fromkeys(h.files()))
except AttributeError: pass
newfiles = [f for f in files if f in contenders]
newfiles = [f for f in match.files() if f in contenders]
if not newfiles:
ui.status(_('no changes to record\n'))
return 0
if changes is None:
changes = repo.status(files=newfiles, match=match)[:5]
match = cmdutil.matchfiles(repo, newfiles)
changes = repo.status(files=match.files(), match=match)[:5]
modified = dict.fromkeys(changes[0])
# 2. backup changed files, so we can restore them in the end

View File

@ -1183,6 +1183,6 @@ def commit(ui, repo, commitfunc, pats, opts):
raise util.Abort(_("file %s not tracked!") % rel)
m = matchfiles(repo, files)
try:
return commitfunc(ui, repo, m.files(), message, m, opts)
return commitfunc(ui, repo, message, m, opts)
except ValueError, inst:
raise util.Abort(str(inst))

View File

@ -562,9 +562,9 @@ def commit(ui, repo, *pats, **opts):
See 'hg help dates' for a list of formats valid for -d/--date.
"""
def commitfunc(ui, repo, files, message, match, opts):
return repo.commit(files, message, opts['user'], opts['date'], match,
force_editor=opts.get('force_editor'))
def commitfunc(ui, repo, message, match, opts):
return repo.commit(match.files(), message, opts['user'], opts['date'],
match, force_editor=opts.get('force_editor'))
node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
if not node: