[PATCH 04 of 10] Disable commit message modification by default and add option for enabling it

Edouard Gomez ed.gomez at free.fr
Sun Dec 17 15:31:50 UTC 2006


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1166365118 -3600
# Node ID a0f26709c4cfd1128afe70fa013d82cb300bef42
# Parent  b7d3ebe398d154e813778d83bb952cffa17cb9b8
Disable commit message modification by default and add option for enabling it

Add CVS date and CVS patchset number to commit log only if specified by the
mean of a new option.

diff -r b7d3ebe398d1 -r a0f26709c4cf 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,13 +4,14 @@ 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:k')
+optlist, args = getopt.getopt(sys.argv[1:], 'd:M:C:m:kl')
 
 cvsroot = None
 module = None
 hgpath = None
 mapfile = None
 expandkeyword = ''
+addcvsinfotolog = False
 for name, value in optlist:
     if   name == '-d':
         cvsroot = value
@@ -22,6 +23,8 @@ for name, value in optlist:
         mapfile = value
     elif name == '-k':
         expandkeyword = '-kk'
+    elif name == '-l':
+        addcvsinfotolog = True
 
 if not cvsroot or not module or not hgpath:
     sys.stderr.write(
@@ -36,6 +39,7 @@ 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)
+ -l: add some CVS information to the commit log message (default: disabled)
 
 Inline manual
 1. Use cvsps to generate patchset information
@@ -241,9 +245,11 @@ def addrev(branch, tag, r, user, date, l
 
         dateconv = str(int(time.mktime(time.strptime(date,
                        "%Y/%m/%d %H:%M:%S")))) + " 0"
-        log.append("\nCVS patchset: %d" % patchset)
-        log.append("CVS date: %s" % date)
-        log.append("")
+        if addcvsinfotolog:
+            log.append("")
+            log.append("CVS patchset: %d" % patchset)
+            log.append("CVS date: %s" % date)
+            log.append("")
         llog = "\n".join(log)
         repo.rawcommit(filelist, llog, user, dateconv, hg.bin(node),
                        wlock=wlock)



More information about the Mercurial-devel mailing list