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

Kirill Smelkov kirr at mns.spb.ru
Thu Jan 10 03:08:46 CST 2008


# HG changeset patch
# User Kirill Smelkov <kirr at mns.spb.ru>
# Date 1199956038 -10800
# Node ID a1c16db879b781916fd331f9e89dec7e8712d31b
# Parent  1dc6a3398775ba7013f24409bffa7573683d9726
cmdutil.commit: extrace 'addremove' from opts carefully

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

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1117,8 +1117,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