##// END OF EJS Templates
match: stop passing files through commitfunc
Matt Mackall -
r6600:b822a379 default
parent child Browse files
Show More
@@ -389,7 +389,7 b' def dorecord(ui, repo, committer, *pats,'
389 if not ui.interactive:
389 if not ui.interactive:
390 raise util.Abort(_('running non-interactively, use commit instead'))
390 raise util.Abort(_('running non-interactively, use commit instead'))
391
391
392 def recordfunc(ui, repo, files, message, match, opts):
392 def recordfunc(ui, repo, message, match, opts):
393 """This is generic record driver.
393 """This is generic record driver.
394
394
395 It's job is to interactively filter local changes, and accordingly
395 It's job is to interactively filter local changes, and accordingly
@@ -402,15 +402,15 b' def dorecord(ui, repo, committer, *pats,'
402 In the end we'll record intresting changes, and everything else will be
402 In the end we'll record intresting changes, and everything else will be
403 left in place, so the user can continue his work.
403 left in place, so the user can continue his work.
404 """
404 """
405 if files:
405 if match.files():
406 changes = None
406 changes = None
407 else:
407 else:
408 changes = repo.status(files=files, match=match)[:5]
408 changes = repo.status(match=match)[:5]
409 modified, added, removed = changes[:3]
409 modified, added, removed = changes[:3]
410 files = modified + added + removed
410 match = cmdutil.matchfiles(repo, modified + added + removed)
411 diffopts = mdiff.diffopts(git=True, nodates=True)
411 diffopts = mdiff.diffopts(git=True, nodates=True)
412 fp = cStringIO.StringIO()
412 fp = cStringIO.StringIO()
413 patch.diff(repo, repo.dirstate.parents()[0], files=files,
413 patch.diff(repo, repo.dirstate.parents()[0], files=match.files(),
414 match=match, changes=changes, opts=diffopts, fp=fp)
414 match=match, changes=changes, opts=diffopts, fp=fp)
415 fp.seek(0)
415 fp.seek(0)
416
416
@@ -423,14 +423,15 b' def dorecord(ui, repo, committer, *pats,'
423 try: contenders.update(dict.fromkeys(h.files()))
423 try: contenders.update(dict.fromkeys(h.files()))
424 except AttributeError: pass
424 except AttributeError: pass
425
425
426 newfiles = [f for f in files if f in contenders]
426 newfiles = [f for f in match.files() if f in contenders]
427
427
428 if not newfiles:
428 if not newfiles:
429 ui.status(_('no changes to record\n'))
429 ui.status(_('no changes to record\n'))
430 return 0
430 return 0
431
431
432 if changes is None:
432 if changes is None:
433 changes = repo.status(files=newfiles, match=match)[:5]
433 match = cmdutil.matchfiles(repo, newfiles)
434 changes = repo.status(files=match.files(), match=match)[:5]
434 modified = dict.fromkeys(changes[0])
435 modified = dict.fromkeys(changes[0])
435
436
436 # 2. backup changed files, so we can restore them in the end
437 # 2. backup changed files, so we can restore them in the end
@@ -1183,6 +1183,6 b' def commit(ui, repo, commitfunc, pats, o'
1183 raise util.Abort(_("file %s not tracked!") % rel)
1183 raise util.Abort(_("file %s not tracked!") % rel)
1184 m = matchfiles(repo, files)
1184 m = matchfiles(repo, files)
1185 try:
1185 try:
1186 return commitfunc(ui, repo, m.files(), message, m, opts)
1186 return commitfunc(ui, repo, message, m, opts)
1187 except ValueError, inst:
1187 except ValueError, inst:
1188 raise util.Abort(str(inst))
1188 raise util.Abort(str(inst))
@@ -562,9 +562,9 b' def commit(ui, repo, *pats, **opts):'
562
562
563 See 'hg help dates' for a list of formats valid for -d/--date.
563 See 'hg help dates' for a list of formats valid for -d/--date.
564 """
564 """
565 def commitfunc(ui, repo, files, message, match, opts):
565 def commitfunc(ui, repo, message, match, opts):
566 return repo.commit(files, message, opts['user'], opts['date'], match,
566 return repo.commit(match.files(), message, opts['user'], opts['date'],
567 force_editor=opts.get('force_editor'))
567 match, force_editor=opts.get('force_editor'))
568
568
569 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
569 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
570 if not node:
570 if not node:
General Comments 0
You need to be logged in to leave comments. Login now