##// END OF EJS Templates
cmdutil: remove redundant commitfunc parameter in amend (API)...
Saurabh Singh -
r34088:a39dce4a default
parent child Browse files
Show More
@@ -614,14 +614,14 b' def kwweb_skip(orig, web, req, tmpl):'
614 if kwt:
614 if kwt:
615 kwt.match = origmatch
615 kwt.match = origmatch
616
616
617 def kw_amend(orig, ui, repo, commitfunc, old, extra, pats, opts):
617 def kw_amend(orig, ui, repo, old, extra, pats, opts):
618 '''Wraps cmdutil.amend expanding keywords after amend.'''
618 '''Wraps cmdutil.amend expanding keywords after amend.'''
619 kwt = getattr(repo, '_keywordkwt', None)
619 kwt = getattr(repo, '_keywordkwt', None)
620 if kwt is None:
620 if kwt is None:
621 return orig(ui, repo, commitfunc, old, extra, pats, opts)
621 return orig(ui, repo, old, extra, pats, opts)
622 with repo.wlock():
622 with repo.wlock():
623 kwt.postcommit = True
623 kwt.postcommit = True
624 newid = orig(ui, repo, commitfunc, old, extra, pats, opts)
624 newid = orig(ui, repo, old, extra, pats, opts)
625 if newid != old.node():
625 if newid != old.node():
626 ctx = repo[newid]
626 ctx = repo[newid]
627 kwt.restrict = True
627 kwt.restrict = True
@@ -3026,8 +3026,7 b' def samefile(f, ctx1, ctx2):'
3026 else:
3026 else:
3027 return f not in ctx2.manifest()
3027 return f not in ctx2.manifest()
3028
3028
3029 # TODO: remove the commitfunc parameter because it is no longer used
3029 def amend(ui, repo, old, extra, pats, opts):
3030 def amend(ui, repo, commitfunc, old, extra, pats, opts):
3031 # avoid cycle context -> subrepo -> cmdutil
3030 # avoid cycle context -> subrepo -> cmdutil
3032 from . import context
3031 from . import context
3033
3032
@@ -1550,15 +1550,7 b' def _docommit(ui, repo, *pats, **opts):'
1550 if not obsolete.isenabled(repo, obsolete.createmarkersopt):
1550 if not obsolete.isenabled(repo, obsolete.createmarkersopt):
1551 cmdutil.checkunfinished(repo)
1551 cmdutil.checkunfinished(repo)
1552
1552
1553 # commitfunc is used only for temporary amend commit by cmdutil.amend
1553 node = cmdutil.amend(ui, repo, old, extra, pats, opts)
1554 def commitfunc(ui, repo, message, match, opts):
1555 return repo.commit(message,
1556 opts.get('user') or old.user(),
1557 opts.get('date') or old.date(),
1558 match,
1559 extra=extra)
1560
1561 node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts)
1562 if node == old.node():
1554 if node == old.node():
1563 ui.status(_("nothing changed\n"))
1555 ui.status(_("nothing changed\n"))
1564 return 1
1556 return 1
@@ -1213,11 +1213,9 b' Test heads computation on pending index '
1213 > command = registrar.command(cmdtable)
1213 > command = registrar.command(cmdtable)
1214 > @command(b"amendtransient",[], _('hg amendtransient [rev]'))
1214 > @command(b"amendtransient",[], _('hg amendtransient [rev]'))
1215 > def amend(ui, repo, *pats, **opts):
1215 > def amend(ui, repo, *pats, **opts):
1216 > def commitfunc(ui, repo, message, match, opts):
1217 > return repo.commit(message, repo['.'].user(), repo['.'].date(), match)
1218 > opts['message'] = 'Test'
1216 > opts['message'] = 'Test'
1219 > opts['logfile'] = None
1217 > opts['logfile'] = None
1220 > cmdutil.amend(ui, repo, commitfunc, repo['.'], {}, pats, opts)
1218 > cmdutil.amend(ui, repo, repo['.'], {}, pats, opts)
1221 > ui.write('%s\n' % repo.changelog.headrevs())
1219 > ui.write('%s\n' % repo.changelog.headrevs())
1222 > EOF
1220 > EOF
1223 $ cat >> $HGRCPATH << EOF
1221 $ cat >> $HGRCPATH << EOF
General Comments 0
You need to be logged in to leave comments. Login now