hg-to-git: add --verbose option
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> Acked-by: Stelian Pop <stelian@popies.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
2d3922dc61
commit
37a12dda24
@ -46,6 +46,7 @@ options:
|
|||||||
for incrementals
|
for incrementals
|
||||||
-n, --nrepack=INT: number of changesets that will trigger
|
-n, --nrepack=INT: number of changesets that will trigger
|
||||||
a repack (default=0, -1 to deactivate)
|
a repack (default=0, -1 to deactivate)
|
||||||
|
-v, --verbose: be verbose
|
||||||
|
|
||||||
required:
|
required:
|
||||||
hgprj: name of the HG project to import (directory)
|
hgprj: name of the HG project to import (directory)
|
||||||
@ -75,15 +76,18 @@ def getgitenv(user, date):
|
|||||||
|
|
||||||
state = ''
|
state = ''
|
||||||
opt_nrepack = 0
|
opt_nrepack = 0
|
||||||
|
verbose = False
|
||||||
|
|
||||||
try:
|
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:
|
for o, a in opts:
|
||||||
if o in ('-s', '--gitstate'):
|
if o in ('-s', '--gitstate'):
|
||||||
state = a
|
state = a
|
||||||
state = os.path.abspath(state)
|
state = os.path.abspath(state)
|
||||||
if o in ('-n', '--nrepack'):
|
if o in ('-n', '--nrepack'):
|
||||||
opt_nrepack = int(a)
|
opt_nrepack = int(a)
|
||||||
|
if o in ('-v', '--verbose'):
|
||||||
|
verbose = True
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
raise('params')
|
raise('params')
|
||||||
except:
|
except:
|
||||||
@ -95,17 +99,20 @@ os.chdir(hgprj)
|
|||||||
|
|
||||||
if state:
|
if state:
|
||||||
if os.path.exists(state):
|
if os.path.exists(state):
|
||||||
print 'State does exist, reading'
|
if verbose:
|
||||||
|
print 'State does exist, reading'
|
||||||
f = open(state, 'r')
|
f = open(state, 'r')
|
||||||
hgvers = pickle.load(f)
|
hgvers = pickle.load(f)
|
||||||
else:
|
else:
|
||||||
print 'State does not exist, first run'
|
print 'State does not exist, first run'
|
||||||
|
|
||||||
tip = os.popen('hg tip --template "{rev}"').read()
|
tip = os.popen('hg tip --template "{rev}"').read()
|
||||||
print 'tip is', tip
|
if verbose:
|
||||||
|
print 'tip is', tip
|
||||||
|
|
||||||
# Calculate the branches
|
# Calculate the branches
|
||||||
print 'analysing the branches...'
|
if verbose:
|
||||||
|
print 'analysing the branches...'
|
||||||
hgchildren["0"] = ()
|
hgchildren["0"] = ()
|
||||||
hgparents["0"] = (None, None)
|
hgparents["0"] = (None, None)
|
||||||
hgbranch["0"] = "master"
|
hgbranch["0"] = "master"
|
||||||
@ -232,7 +239,8 @@ if hgnewcsets >= opt_nrepack and opt_nrepack != -1:
|
|||||||
|
|
||||||
# write the state for incrementals
|
# write the state for incrementals
|
||||||
if state:
|
if state:
|
||||||
print 'Writing state'
|
if verbose:
|
||||||
|
print 'Writing state'
|
||||||
f = open(state, 'w')
|
f = open(state, 'w')
|
||||||
pickle.dump(hgvers, f)
|
pickle.dump(hgvers, f)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user