mq: fix qimport --name --existing --force on win32
os.rename() does not overwrite existing targets on Windows.
--- a/hgext/mq.py Fri Jul 23 23:43:43 2010 +0900
+++ b/hgext/mq.py Wed Jul 28 11:07:20 2010 +0200
@@ -1699,7 +1699,7 @@
self.ui.write(_('renaming %s to %s\n')
% (filename, patchname))
- os.rename(originpath, self.join(patchname))
+ util.rename(originpath, self.join(patchname))
else:
patchname = filename
--- a/tests/test-mq-qimport Fri Jul 23 23:43:43 2010 +0900
+++ b/tests/test-mq-qimport Wed Jul 28 11:07:20 2010 +0200
@@ -118,3 +118,10 @@
echo % qimport -e --name newname oldexisitingpatch
hg qimport -e --name this-name-is-better 2.diff
hg qser
+echo % qimport -e --name without --force
+cp .hg/patches/this-name-is-better .hg/patches/3.diff
+hg qimport -e --name this-name-is-better 3.diff
+hg qser
+echo % qimport -e --name with --force
+hg qimport --force -e --name this-name-is-better 3.diff
+hg qser
--- a/tests/test-mq-qimport.out Fri Jul 23 23:43:43 2010 +0900
+++ b/tests/test-mq-qimport.out Wed Jul 28 11:07:20 2010 +0200
@@ -61,3 +61,12 @@
adding this-name-is-better to series file
this-name-is-better
url.diff
+% qimport -e --name without --force
+abort: patch "this-name-is-better" already exists
+this-name-is-better
+url.diff
+% qimport -e --name with --force
+renaming 3.diff to this-name-is-better
+adding this-name-is-better to series file
+this-name-is-better
+url.diff