[PATCH 03 of 12] Add option for disabling CVS keyword expansion

Edouard Gomez ed.gomez at free.fr
Tue Dec 19 00:05:44 CST 2006


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1166511815 -3600
# Node ID d8bea75565f6c62100c9731f6fd4e78afbde766e
# Parent  c1fc3744581c8c009f6fcdc200ea3dc05b1d79f7
Add option for disabling CVS keyword expansion

CVS keywords are of little interest for some conversions. Add an option
to disable their expansion.

diff -r c1fc3744581c -r d8bea75565f6 hg-cvs-import
--- a/hg-cvs-import	Tue Dec 19 08:03:35 2006 +0100
+++ b/hg-cvs-import	Tue Dec 19 08:03:35 2006 +0100
@@ -4,12 +4,13 @@ from mercurial import ui, hg, revlog, co
 from mercurial import ui, hg, revlog, commands, util
 
 version = 0.7
-optlist, args = getopt.getopt(sys.argv[1:], 'd:M:C:m:')
+optlist, args = getopt.getopt(sys.argv[1:], 'd:M:C:m:k')
 
 cvsroot = None
 module = None
 hgpath = None
 mapfile = None
+expandkeyword = ''
 for name, value in optlist:
     if   name == '-d':
         cvsroot = value
@@ -19,6 +20,8 @@ for name, value in optlist:
         hgpath = value
     elif name == '-m':
         mapfile = value
+    elif name == '-k':
+        expandkeyword = '-kk'
 
 if not cvsroot or not module or not hgpath:
     sys.stderr.write(
@@ -32,6 +35,8 @@ Optional options:
 Optional options:
  cvsps file: filename of the cvsps file. Can be '-' for stdin (default: stdin)
  -m mapfile: file where (cvs,hg) node couples are saved (default: map)
+ -k: disable CVS keyword expansion when checking out files
+     (default: keywords expanded)
 
 Inline manual
 1. Use cvsps to generate patchset information
@@ -110,7 +115,7 @@ def start_checkout(file, rev):
             pass
         return None
     cvsfile = cvsfile.replace("'", "\'")
-    f = os.popen("co -q -p -r%s '%s'" % (rev, cvsfile), 'r', 262144)
+    f = os.popen("co -q -p %s -r%s '%s'" % (expandkeyword, rev, cvsfile), 'r', 262144)
     if not f:
         sys.stderr.write("os.popen failed for %s\n" % cvsfile)
         sys.exit(1)


More information about the Mercurial-devel mailing list