Don't require opts['dry_run'] to be set to fix external tools like tailor.
authorThomas Arendsen Hein <thomas@intevation.de>
Tue, 27 Jun 2006 08:31:03 +0200
changeset 2503 37655f10ced6
parent 2502 18cf95ad3666
child 2510 cbff06469488
child 2526 37785f986260
Don't require opts['dry_run'] to be set to fix external tools like tailor.
mercurial/commands.py
--- a/mercurial/commands.py	Mon Jun 26 22:44:48 2006 +0200
+++ b/mercurial/commands.py	Tue Jun 27 08:31:03 2006 +0200
@@ -650,7 +650,7 @@
         elif repo.dirstate.state(abs) == '?':
             ui.status(_('adding %s\n') % rel)
             names.append(abs)
-    if not opts['dry_run']:
+    if not opts.get('dry_run'):
         repo.add(names)
 
 def addremove(ui, repo, *pats, **opts):
@@ -1076,21 +1076,21 @@
                 ui.warn(_('%s: not overwriting - file exists\n') %
                         reltarget)
                 return
-            if not opts['after'] and not opts['dry_run']:
+            if not opts['after'] and not opts.get('dry_run'):
                 os.unlink(reltarget)
         if opts['after']:
             if not os.path.exists(reltarget):
                 return
         else:
             targetdir = os.path.dirname(reltarget) or '.'
-            if not os.path.isdir(targetdir) and not opts['dry_run']:
+            if not os.path.isdir(targetdir) and not opts.get('dry_run'):
                 os.makedirs(targetdir)
             try:
                 restore = repo.dirstate.state(abstarget) == 'r'
-                if restore and not opts['dry_run']:
+                if restore and not opts.get('dry_run'):
                     repo.undelete([abstarget], wlock)
                 try:
-                    if not opts['dry_run']:
+                    if not opts.get('dry_run'):
                         shutil.copyfile(relsrc, reltarget)
                         shutil.copymode(relsrc, reltarget)
                     restore = False
@@ -1110,7 +1110,7 @@
         if ui.verbose or not exact:
             ui.status(_('copying %s to %s\n') % (relsrc, reltarget))
         targets[abstarget] = abssrc
-        if abstarget != origsrc and not opts['dry_run']:
+        if abstarget != origsrc and not opts.get('dry_run'):
             repo.copy(origsrc, abstarget, wlock)
         copied.append((abssrc, relsrc, exact))
 
@@ -2334,7 +2334,7 @@
         if ui.verbose or not exact:
             ui.status(_('removing %s\n') % rel)
         names.append(abs)
-    if not opts['dry_run']:
+    if not opts.get('dry_run'):
         repo.remove(names, True, wlock)
     return errs