changeset 96:9746227239e0

client: fix import --no-commit flag (issue3206)
author Idan Kamara <idankk86@gmail.com>
date Mon, 16 Jan 2012 12:52:30 +0200
parents bd23bc72e662
children 705e601e6085
files hglib/client.py tests/test-import.py
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hglib/client.py	Thu Dec 22 19:12:47 2011 +0200
+++ b/hglib/client.py	Mon Jan 16 12:52:30 2012 +0200
@@ -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)
--- a/tests/test-import.py	Thu Dec 22 19:12:47 2011 +0200
+++ b/tests/test-import.py	Mon Jan 16 12:52:30 2012 +0200
@@ -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')