[PATCH 1 of 2 hglib] client: fix import --no-commit flag (issue3206)

Idan Kamara idankk86 at gmail.com
Mon Jan 16 04:56:57 CST 2012


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1326711150 -7200
# Node ID 9746227239e0ed738a9db3eb103aff5a701e13ac
# Parent  bd23bc72e6620cb6fc25df6567bad6ee6a2e1ab2
client: fix import --no-commit flag (issue3206)

diff --git a/hglib/client.py b/hglib/client.py
--- a/hglib/client.py
+++ b/hglib/client.py
@@ -834,7 +834,7 @@
             input = None
 
         args = cmdbuilder('import', strip=strip, force=force,
-                          nocommit=nocommit, bypass=bypass, exact=exact,
+                          no_commit=nocommit, bypass=bypass, exact=exact,
                           importbranch=importbranch, message=message,
                           date=date, user=user, similarity=similarity, _=stdin,
                           *patches)
diff --git a/tests/test-import.py b/tests/test-import.py
--- a/tests/test-import.py
+++ b/tests/test-import.py
@@ -1,4 +1,4 @@
-import common, cStringIO
+import common, cStringIO, os
 import hglib
 
 patch = """
@@ -23,5 +23,13 @@
 
     def test_basic_file(self):
         open('patch', 'wb').write(patch)
+
+        # --no-commit
+        self.client.import_(['patch'], nocommit=True)
+        self.assertEquals(open('a').read(), '1\n')
+
+        self.client.update(clean=True)
+        os.remove('a')
+
         self.client.import_(['patch'])
         self.assertEquals(self.client.cat(['a']), '1\n')


More information about the Mercurial-devel mailing list