diff mercurial/commands.py @ 16274:5d75eb8568d1

encoding: tune fast-path of tolocal a bit
author Matt Mackall <mpm@selenic.com>
date Thu, 22 Mar 2012 16:54:46 -0500
parents 0d175ac527c1
children a740fa28d718
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Mar 15 16:57:19 2012 +0100
+++ b/mercurial/commands.py	Thu Mar 22 16:54:46 2012 -0500
@@ -3622,8 +3622,9 @@
     try:
         try:
             wlock = repo.wlock()
-            lock = repo.lock()
-            tr = repo.transaction('import')
+            if not opts.get('no_commit'):
+                lock = repo.lock()
+                tr = repo.transaction('import')
             parents = repo.parents()
             for patchurl in patches:
                 if patchurl == '-':
@@ -3649,7 +3650,8 @@
                 if not haspatch:
                     raise util.Abort(_('%s: no diffs found') % patchurl)
 
-            tr.close()
+            if tr:
+                tr.close()
             if msgs:
                 repo.savecommitmessage('\n* * *\n'.join(msgs))
         except: