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

Edouard Gomez ed.gomez at free.fr
Sun Dec 17 09:31:49 CST 2006


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1166365118 -3600
# Node ID b7d3ebe398d154e813778d83bb952cffa17cb9b8
# Parent  477b544463c609d728cb279ed6763d774877b3a9
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 477b544463c6 -r b7d3ebe398d1 hg-cvs-import
--- a/hg-cvs-import	Sun Dec 17 15:18:38 2006 +0100
+++ b/hg-cvs-import	Sun Dec 17 15:18:38 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,7 @@ 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: disabled)
 
 Inline manual
 1. Use cvsps to generate patchset information
@@ -110,7 +114,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