Enforce unixish style for all generated patch names.
User supplied names are left unchanged (including those loaded from series).
--- a/hgext/mq.py Tue Jan 16 12:52:03 2007 -0800
+++ b/hgext/mq.py Wed Jan 17 22:19:36 2007 +0100
@@ -35,6 +35,10 @@
commands.norepo += " qclone qversion"
+# Patch names looks like unix-file names.
+# They must be joinable with queue directory and result in the patch path.
+normname = util.normpath
+
class statusentry:
def __init__(self, rev, name=None):
if not name:
@@ -1335,7 +1339,7 @@
lastparent = p1
if not patchname:
- patchname = '%d.diff' % r
+ patchname = normname('%d.diff' % r)
checkseries(patchname)
checkfile(patchname)
self.full_series.insert(0, patchname)
@@ -1357,7 +1361,7 @@
if filename == '-':
raise util.Abort(_('-e is incompatible with import from -'))
if not patchname:
- patchname = filename
+ patchname = normname(filename)
if not os.path.isfile(self.join(patchname)):
raise util.Abort(_("patch %s does not exist") % patchname)
else:
@@ -1371,7 +1375,7 @@
except IOError:
raise util.Abort(_("unable to read %s") % patchname)
if not patchname:
- patchname = os.path.basename(filename)
+ patchname = normname(os.path.basename(filename))
checkfile(patchname)
patchf = self.opener(patchname, "w")
patchf.write(text)
@@ -1804,7 +1808,7 @@
patch = q.lookup('qtip')
absdest = q.join(name)
if os.path.isdir(absdest):
- name = os.path.join(name, os.path.basename(patch))
+ name = normname(os.path.join(name, os.path.basename(patch)))
absdest = q.join(name)
if os.path.exists(absdest):
raise util.Abort(_('%s already exists') % absdest)