[PATCH 4 of 5] cmdutil.commit: extrace 'addremove' from opts carefully

Kirill Smelkov kirr at mns.spb.ru
Thu Dec 27 13:01:44 CST 2007


# HG changeset patch
# User Kirill Smelkov <kirr at mns.spb.ru>
# Date 1198781962 -10800
# Node ID eda06f8a6316b650b557710a69f8d193b75b2e35
# Parent  6860842706b35919c8f82d7fe627292d74dd9c35
cmdutil.commit: extrace 'addremove' from opts carefully

rationale: we are going to use cmdutil.commit for qrecord, and it's brother
rationale: qrefresh does not support addremove.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1106,8 +1106,11 @@ def commit(ui, repo, commitfunc, pats, o
     '''commit the specified files or all outstanding changes'''
     message = logmessage(opts)
 
-    if opts['addremove']:
+    # extract addremove carefully -- this function can be called from a command
+    # that doesn't support addremove
+    if opts.get('addremove'):
         addremove(repo, pats, opts)
+
     fns, match, anypats = matchpats(repo, pats, opts)
     if pats:
         status = repo.status(files=fns, match=match)


More information about the Mercurial-devel mailing list