git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hg-to-git: add --verbose option
@ 2008-05-26 12:46 Johannes Schindelin
  2008-05-26 13:09 ` Johan Herland
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2008-05-26 12:46 UTC (permalink / raw)
  To: Stelian Pop, git, gitster


This patch adds an option to make hg-to-git quiet by default.  Note:
it only suppresses those messages that would be printed when everything
was up-to-date.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	Yeah, I know, a Python hater codes in Python.  Well, somebody told
	me I had to code in it until I do not hate it anymore.

 contrib/hg-to-git/hg-to-git.py |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index d72ffbb..daad399 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -46,6 +46,7 @@ options:
                          for incrementals
     -n, --nrepack=INT:   number of changesets that will trigger
                          a repack (default=0, -1 to deactivate)
+    -v, --verbose:       be verbose
 
 required:
     hgprj:  name of the HG project to import (directory)
@@ -75,15 +76,18 @@ def getgitenv(user, date):
 
 state = ''
 opt_nrepack = 0
+verbose = ''
 
 try:
-    opts, args = getopt.getopt(sys.argv[1:], 's:t:n:', ['gitstate=', 'tempdir=', 'nrepack='])
+    opts, args = getopt.getopt(sys.argv[1:], 's:t:n:v', ['gitstate=', 'tempdir=', 'nrepack=', 'verbose'])
     for o, a in opts:
         if o in ('-s', '--gitstate'):
             state = a
             state = os.path.abspath(state)
         if o in ('-n', '--nrepack'):
             opt_nrepack = int(a)
+        if o in ('-v', '--verbose'):
+            verbose = true
     if len(args) != 1:
         raise('params')
 except:
@@ -95,17 +99,20 @@ os.chdir(hgprj)
 
 if state:
     if os.path.exists(state):
-        print 'State does exist, reading'
+        if verbose:
+            print 'State does exist, reading'
         f = open(state, 'r')
         hgvers = pickle.load(f)
     else:
         print 'State does not exist, first run'
 
 tip = os.popen('hg tip --template "{rev}"').read()
-print 'tip is', tip
+if verbose:
+    print 'tip is', tip
 
 # Calculate the branches
-print 'analysing the branches...'
+if verbose:
+    print 'analysing the branches...'
 hgchildren["0"] = ()
 hgparents["0"] = (None, None)
 hgbranch["0"] = "master"
@@ -232,7 +239,8 @@ if hgnewcsets >= opt_nrepack and opt_nrepack != -1:
 
 # write the state for incrementals
 if state:
-    print 'Writing state'
+    if verbose:
+        print 'Writing state'
     f = open(state, 'w')
     pickle.dump(hgvers, f)
 
-- 
1.5.5.GIT

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-05-26 21:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-26 12:46 [PATCH] hg-to-git: add --verbose option Johannes Schindelin
2008-05-26 13:09 ` Johan Herland
2008-05-26 13:14   ` Johannes Schindelin
2008-05-26 13:28     ` Sverre Rabbelier
2008-05-26 17:19       ` Junio C Hamano
2008-05-26 21:29         ` David Symonds
2008-05-26 21:47           ` Johannes Schindelin
2008-05-26 13:20   ` [PATCH v2] " Johannes Schindelin
2008-05-26 14:33     ` Stelian Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).