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

Edouard Gomez ed.gomez at free.fr
Tue Dec 19 06:05:45 UTC 2006


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1166511815 -3600
# Node ID 4390635f31ce67052228a76f6c66383c0cde9cf2
# Parent  d8bea75565f6c62100c9731f6fd4e78afbde766e
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 d8bea75565f6 -r 4390635f31ce 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,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(
@@ -37,6 +40,7 @@ Optional options:
  -m mapfile: file where (cvs,hg) node couples are saved (default: map)
  -k: disable CVS keyword expansion when checking out files
      (default: keywords expanded)
+ -l: add some CVS information to the commit log message (default: disabled)
 
 Inline manual
 1. Use cvsps to generate patchset information
@@ -242,9 +246,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