* [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
* Re: [PATCH] hg-to-git: add --verbose option
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:20 ` [PATCH v2] " Johannes Schindelin
0 siblings, 2 replies; 9+ messages in thread
From: Johan Herland @ 2008-05-26 13:09 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, Stelian Pop, gitster
On Monday 26 May 2008, Johannes Schindelin wrote:
> 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.
Looks ok to me. :)
> 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 = ''
Maybe this should be
verbose = false
since it indicates your intent to exclusively use this variable as a
boolean.
The rest is ok, AFAICS.
Have fun! :)
...Johan
--
Johan Herland, <johan@herland.net>
www.herland.net
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] hg-to-git: add --verbose option
2008-05-26 13:09 ` Johan Herland
@ 2008-05-26 13:14 ` Johannes Schindelin
2008-05-26 13:28 ` Sverre Rabbelier
2008-05-26 13:20 ` [PATCH v2] " Johannes Schindelin
1 sibling, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2008-05-26 13:14 UTC (permalink / raw)
To: Johan Herland; +Cc: git, Stelian Pop, gitster
Hi,
On Mon, 26 May 2008, Johan Herland wrote:
> On Monday 26 May 2008, Johannes Schindelin wrote:
>
> > @@ -75,15 +76,18 @@ def getgitenv(user, date):
> >
> > state = ''
> > opt_nrepack = 0
> > +verbose = ''
>
> Maybe this should be
> verbose = false
> since it indicates your intent to exclusively use this variable as a
> boolean.
Now, that is not even funny, as that was my initial version, and Python
complained about not knowing "false".
Ciao,
Dscho
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] hg-to-git: add --verbose option
2008-05-26 13:09 ` Johan Herland
2008-05-26 13:14 ` Johannes Schindelin
@ 2008-05-26 13:20 ` Johannes Schindelin
2008-05-26 14:33 ` Stelian Pop
1 sibling, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2008-05-26 13:20 UTC (permalink / raw)
To: Johan Herland; +Cc: git, Stelian Pop, 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>
---
On Mon, 26 May 2008, Johan Herland wrote:
> verbose = false
Pieter on IRC just pointed out that it should be capitalized.
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..f68ef72 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 = False
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
* Re: [PATCH] hg-to-git: add --verbose option
2008-05-26 13:14 ` Johannes Schindelin
@ 2008-05-26 13:28 ` Sverre Rabbelier
2008-05-26 17:19 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Sverre Rabbelier @ 2008-05-26 13:28 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Johan Herland, git, Stelian Pop, gitster
On Mon, May 26, 2008 at 3:14 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Now, that is not even funny, as that was my initial version, and Python
> complained about not knowing "false".
That is because in python the keyword is "False" (note the capital 'F').
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] hg-to-git: add --verbose option
2008-05-26 13:20 ` [PATCH v2] " Johannes Schindelin
@ 2008-05-26 14:33 ` Stelian Pop
0 siblings, 0 replies; 9+ messages in thread
From: Stelian Pop @ 2008-05-26 14:33 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Johan Herland, git, gitster
Le lundi 26 mai 2008 à 14:20 +0100, Johannes Schindelin a écrit :
> 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>
Thanks,
--
Stelian Pop <stelian@popies.net>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] hg-to-git: add --verbose option
2008-05-26 13:28 ` Sverre Rabbelier
@ 2008-05-26 17:19 ` Junio C Hamano
2008-05-26 21:29 ` David Symonds
0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2008-05-26 17:19 UTC (permalink / raw)
To: sverre; +Cc: Johannes Schindelin, Johan Herland, git, Stelian Pop, gitster
"Sverre Rabbelier" <alturin@gmail.com> writes:
> On Mon, May 26, 2008 at 3:14 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>> Now, that is not even funny, as that was my initial version, and Python
>> complained about not knowing "false".
>
> That is because in python the keyword is "False" (note the capital 'F').
I too write True/False in my recent Python code, but I vaguely recall they
were relatively new to the language. I think it was 2.3 which is probably
5 years old by now, so if that is the case we probably are safe (and they
are used in p4import anyway).
I think I spotted a bug in Python documentation, by the way ;-)
http://docs.python.org/ref/ref.html does not even list "True" and "False"
in its section 2.4 (Literals) yet, and that document is for version 2.5.2.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] hg-to-git: add --verbose option
2008-05-26 17:19 ` Junio C Hamano
@ 2008-05-26 21:29 ` David Symonds
2008-05-26 21:47 ` Johannes Schindelin
0 siblings, 1 reply; 9+ messages in thread
From: David Symonds @ 2008-05-26 21:29 UTC (permalink / raw)
To: Junio C Hamano
Cc: sverre, Johannes Schindelin, Johan Herland, git, Stelian Pop
On Tue, May 27, 2008 at 3:19 AM, Junio C Hamano <gitster@pobox.com> wrote:
> I think I spotted a bug in Python documentation, by the way ;-)
>
> http://docs.python.org/ref/ref.html does not even list "True" and "False"
> in its section 2.4 (Literals) yet, and that document is for version 2.5.2.
That's because they aren't literals. They are, in fact, objects, and
redefinable objects at that.
Try:
True=False
print True
Dave.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] hg-to-git: add --verbose option
2008-05-26 21:29 ` David Symonds
@ 2008-05-26 21:47 ` Johannes Schindelin
0 siblings, 0 replies; 9+ messages in thread
From: Johannes Schindelin @ 2008-05-26 21:47 UTC (permalink / raw)
To: David Symonds; +Cc: Junio C Hamano, sverre, Johan Herland, git, Stelian Pop
Hi,
On Tue, 27 May 2008, David Symonds wrote:
> On Tue, May 27, 2008 at 3:19 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> > I think I spotted a bug in Python documentation, by the way ;-)
> >
> > http://docs.python.org/ref/ref.html does not even list "True" and
> > "False" in its section 2.4 (Literals) yet, and that document is for
> > version 2.5.2.
>
> That's because they aren't literals. They are, in fact, objects, and
> redefinable objects at that.
>
> Try:
>
> True=False
> print True
Hey, I said that I had to code in Python until I do not hate it anymore!
You just made that task harder.
Thanks,
Dscho
^ permalink raw reply [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).