mirror of
https://github.com/facebook/sapling.git
synced 2025-01-06 04:43:19 +03:00
cmdutil: move -M / --reuse-message handling to cmdutil.logmessage
Summary: This just moves `-M / --reuse-message` handling from the `commit` command to a lower layer, making it more reusable. Reviewed By: xavierd Differential Revision: D17168992 fbshipit-source-id: 4fe7e93ceae45eff281214dcff03ef3f9ee0c898
This commit is contained in:
parent
fd071d2076
commit
15f97d7f53
@ -857,6 +857,19 @@ def bailifchanged(repo, merge=True, hint=None):
|
||||
def logmessage(repo, opts):
|
||||
""" get the log message according to -m and -l option """
|
||||
ui = repo.ui
|
||||
|
||||
# Allow the commit message from another commit to be reused.
|
||||
reuserev = opts.get("reuse_message")
|
||||
if reuserev:
|
||||
incompatibleopts = ["message", "logfile"]
|
||||
currentinvaliopts = [opt for opt in incompatibleopts if opts.get(opt)]
|
||||
if currentinvaliopts:
|
||||
raise error.Abort(
|
||||
_("--reuse-message and --%s are mutually exclusive")
|
||||
% (currentinvaliopts[0])
|
||||
)
|
||||
opts["message"] = scmutil.revsingle(repo, reuserev).description()
|
||||
|
||||
message = opts.get("message")
|
||||
logfile = opts.get("logfile")
|
||||
|
||||
|
@ -1714,18 +1714,6 @@ def _docommit(ui, repo, *pats, **opts):
|
||||
|
||||
opts = pycompat.byteskwargs(opts)
|
||||
|
||||
# Allow the commit message from another commit to be reused.
|
||||
reuserev = opts.get("reuse_message")
|
||||
if reuserev:
|
||||
incompatibleopts = ["message", "logfile"]
|
||||
currentinvaliopts = [opt for opt in incompatibleopts if opts.get(opt)]
|
||||
if currentinvaliopts:
|
||||
raise error.Abort(
|
||||
_("--reuse-message and --%s are mutually exclusive")
|
||||
% (currentinvaliopts[0])
|
||||
)
|
||||
opts["message"] = scmutil.revsingle(repo, reuserev).description()
|
||||
|
||||
cmdutil.checkunfinished(repo, commit=True)
|
||||
|
||||
branch = repo[None].branch()
|
||||
|
Loading…
Reference in New Issue
Block a user