[PATCH] Add --no-commit option to import command

Joel Rosdahl joel at rosdahl.net
Sat Apr 28 15:00:42 UTC 2007


Suggestion: Add a --no-commit option to the import command. I find it
useful, at least.

# HG changeset patch
# User Joel Rosdahl <joel at rosdahl.net>
# Date 1177772108 -7200
# Node ID bb9de62cb5897c70298f3b29d651ff63223fb9fa
# Parent  534f79754495621289d945d8e2a42cf1ef258c89
Add --no-commit option to import command

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1559,11 +1559,12 @@ def import_(ui, repo, patch1, *patches, 
                                    files=files)
             finally:
                 files = patch.updatedir(ui, repo, files, wlock=wlock)
-            n = repo.commit(files, message, user, date, wlock=wlock, lock=lock)
-            if opts.get('exact'):
-                if hex(n) != nodeid:
-                    repo.rollback()
-                    raise util.Abort(_('patch is damaged or loses information'))
+            if not opts.get('no-commit'):
+                n = repo.commit(files, message, user, date, wlock=wlock, lock=lock)
+                if opts.get('exact'):
+                    if hex(n) != nodeid:
+                        repo.rollback()
+                        raise util.Abort(_('patch is damaged or loses information'))
         finally:
             os.unlink(tmpname)
 
@@ -2817,6 +2818,7 @@ table = {
           ('b', 'base', '', _('base path')),
           ('f', 'force', None,
            _('skip check for outstanding uncommitted changes')),
+          ('', 'no-commit', None, _("don't commit, just update the working directory")),
           ('', 'exact', None,
            _('apply patch to the nodes from which it was generated'))] + commitopts,
          _('hg import [-p NUM] [-m MESSAGE] [-f] PATCH...')),

-- 
Joel Rosdahl <joel at rosdahl.net>
Key BB845E97; fingerprint 9F4B D780 6EF4 5700 778D  8B22 0064 F9FF BB84 5E97



More information about the Mercurial-devel mailing list