{"thread":{"id":"13670","subject":"[PATCH] hg-to-git: add --verbose option","startedAt":"2008-05-26T12:46:06Z","lastAt":"2008-05-26T21:47:47Z","messageCount":9,"participants":["Johannes Schindelin","Johan Herland","Sverre Rabbelier","Stelian Pop","Junio C Hamano","David Symonds"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"77770","messageId":"alpine.DEB.1.00.0805261344420.30431@racer","threadId":"13670","inReplyTo":null,"subject":"[PATCH] hg-to-git: add --verbose option","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-26T12:46:06Z","receivedAt":"2008-05-26T12:46:06Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis patch adds an option to make hg-to-git quiet by default.  Note:\nit only suppresses those messages that would be printed when everything\nwas up-to-date.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tYeah, I know, a Python hater codes in Python.  Well, somebody told\n\tme I had to code in it until I do not hate it anymore.\n\n contrib/hg-to-git/hg-to-git.py |   18 +++++++++++++-----\n 1 files changed, 13 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py\nindex d72ffbb..daad399 100755\n--- a/contrib/hg-to-git/hg-to-git.py\n+++ b/contrib/hg-to-git/hg-to-git.py\n@@ -46,6 +46,7 @@ options:\n                          for incrementals\n     -n, --nrepack=INT:   number of changesets that will trigger\n                          a repack (default=0, -1 to deactivate)\n+    -v, --verbose:       be verbose\n \n required:\n     hgprj:  name of the HG project to import (directory)\n@@ -75,15 +76,18 @@ def getgitenv(user, date):\n \n state = ''\n opt_nrepack = 0\n+verbose = ''\n \n try:\n-    opts, args = getopt.getopt(sys.argv[1:], 's:t:n:', ['gitstate=', 'tempdir=', 'nrepack='])\n+    opts, args = getopt.getopt(sys.argv[1:], 's:t:n:v', ['gitstate=', 'tempdir=', 'nrepack=', 'verbose'])\n     for o, a in opts:\n         if o in ('-s', '--gitstate'):\n             state = a\n             state = os.path.abspath(state)\n         if o in ('-n', '--nrepack'):\n             opt_nrepack = int(a)\n+        if o in ('-v', '--verbose'):\n+            verbose = true\n     if len(args) != 1:\n         raise('params')\n except:\n@@ -95,17 +99,20 @@ os.chdir(hgprj)\n \n if state:\n     if os.path.exists(state):\n-        print 'State does exist, reading'\n+        if verbose:\n+            print 'State does exist, reading'\n         f = open(state, 'r')\n         hgvers = pickle.load(f)\n     else:\n         print 'State does not exist, first run'\n \n tip = os.popen('hg tip --template \"{rev}\"').read()\n-print 'tip is', tip\n+if verbose:\n+    print 'tip is', tip\n \n # Calculate the branches\n-print 'analysing the branches...'\n+if verbose:\n+    print 'analysing the branches...'\n hgchildren[\"0\"] = ()\n hgparents[\"0\"] = (None, None)\n hgbranch[\"0\"] = \"master\"\n@@ -232,7 +239,8 @@ if hgnewcsets >= opt_nrepack and opt_nrepack != -1:\n \n # write the state for incrementals\n if state:\n-    print 'Writing state'\n+    if verbose:\n+        print 'Writing state'\n     f = open(state, 'w')\n     pickle.dump(hgvers, f)\n \n-- \n1.5.5.GIT\n"},{"id":"77771","messageId":"200805261509.49841.johan@herland.net","threadId":"13670","inReplyTo":"alpine.DEB.1.00.0805261344420.30431@racer","subject":"Re: [PATCH] hg-to-git: add --verbose option","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2008-05-26T13:09:49Z","receivedAt":"2008-05-26T13:09:49Z","isPatch":true,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Monday 26 May 2008, Johannes Schindelin wrote:\n> This patch adds an option to make hg-to-git quiet by default.  Note:\n> it only suppresses those messages that would be printed when\n> everything was up-to-date.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>\n> \tYeah, I know, a Python hater codes in Python.  Well, somebody told\n> \tme I had to code in it until I do not hate it anymore.\n\nLooks ok to me. :)\n\n>  contrib/hg-to-git/hg-to-git.py |   18 +++++++++++++-----\n>  1 files changed, 13 insertions(+), 5 deletions(-)\n>\n> diff --git a/contrib/hg-to-git/hg-to-git.py\n> b/contrib/hg-to-git/hg-to-git.py index d72ffbb..daad399 100755\n> --- a/contrib/hg-to-git/hg-to-git.py\n> +++ b/contrib/hg-to-git/hg-to-git.py\n> @@ -46,6 +46,7 @@ options:\n>                           for incrementals\n>      -n, --nrepack=INT:   number of changesets that will trigger\n>                           a repack (default=0, -1 to deactivate)\n> +    -v, --verbose:       be verbose\n>\n>  required:\n>      hgprj:  name of the HG project to import (directory)\n> @@ -75,15 +76,18 @@ def getgitenv(user, date):\n>\n>  state = ''\n>  opt_nrepack = 0\n> +verbose = ''\n\nMaybe this should be\n\tverbose = false\nsince it indicates your intent to exclusively use this variable as a\nboolean.\n\nThe rest is ok, AFAICS.\n\n\nHave fun! :)\n\n...Johan\n\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"77772","messageId":"alpine.DEB.1.00.0805261414140.30431@racer","threadId":"13670","inReplyTo":"200805261509.49841.johan@herland.net","subject":"Re: [PATCH] hg-to-git: add --verbose option","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-26T13:14:49Z","receivedAt":"2008-05-26T13:14:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 26 May 2008, Johan Herland wrote:\n\n> On Monday 26 May 2008, Johannes Schindelin wrote:\n>\n> > @@ -75,15 +76,18 @@ def getgitenv(user, date):\n> >\n> >  state = ''\n> >  opt_nrepack = 0\n> > +verbose = ''\n> \n> Maybe this should be\n> \tverbose = false\n> since it indicates your intent to exclusively use this variable as a\n> boolean.\n\nNow, that is not even funny, as that was my initial version, and Python \ncomplained about not knowing \"false\".\n\nCiao,\nDscho\n"},{"id":"77774","messageId":"alpine.DEB.1.00.0805261419440.30431@racer","threadId":"13670","inReplyTo":"200805261509.49841.johan@herland.net","subject":"[PATCH v2] hg-to-git: add --verbose option","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-26T13:20:54Z","receivedAt":"2008-05-26T13:20:54Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis patch adds an option to make hg-to-git quiet by default.  Note:\nit only suppresses those messages that would be printed when everything\nwas up-to-date.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Mon, 26 May 2008, Johan Herland wrote:\n\n\t> \tverbose = false\n\n\tPieter on IRC just pointed out that it should be capitalized.\n\n contrib/hg-to-git/hg-to-git.py |   18 +++++++++++++-----\n 1 files changed, 13 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py\nindex d72ffbb..f68ef72 100755\n--- a/contrib/hg-to-git/hg-to-git.py\n+++ b/contrib/hg-to-git/hg-to-git.py\n@@ -46,6 +46,7 @@ options:\n                          for incrementals\n     -n, --nrepack=INT:   number of changesets that will trigger\n                          a repack (default=0, -1 to deactivate)\n+    -v, --verbose:       be verbose\n \n required:\n     hgprj:  name of the HG project to import (directory)\n@@ -75,15 +76,18 @@ def getgitenv(user, date):\n \n state = ''\n opt_nrepack = 0\n+verbose = False\n \n try:\n-    opts, args = getopt.getopt(sys.argv[1:], 's:t:n:', ['gitstate=', 'tempdir=', 'nrepack='])\n+    opts, args = getopt.getopt(sys.argv[1:], 's:t:n:v', ['gitstate=', 'tempdir=', 'nrepack=', 'verbose'])\n     for o, a in opts:\n         if o in ('-s', '--gitstate'):\n             state = a\n             state = os.path.abspath(state)\n         if o in ('-n', '--nrepack'):\n             opt_nrepack = int(a)\n+        if o in ('-v', '--verbose'):\n+            verbose = True\n     if len(args) != 1:\n         raise('params')\n except:\n@@ -95,17 +99,20 @@ os.chdir(hgprj)\n \n if state:\n     if os.path.exists(state):\n-        print 'State does exist, reading'\n+        if verbose:\n+            print 'State does exist, reading'\n         f = open(state, 'r')\n         hgvers = pickle.load(f)\n     else:\n         print 'State does not exist, first run'\n \n tip = os.popen('hg tip --template \"{rev}\"').read()\n-print 'tip is', tip\n+if verbose:\n+    print 'tip is', tip\n \n # Calculate the branches\n-print 'analysing the branches...'\n+if verbose:\n+    print 'analysing the branches...'\n hgchildren[\"0\"] = ()\n hgparents[\"0\"] = (None, None)\n hgbranch[\"0\"] = \"master\"\n@@ -232,7 +239,8 @@ if hgnewcsets >= opt_nrepack and opt_nrepack != -1:\n \n # write the state for incrementals\n if state:\n-    print 'Writing state'\n+    if verbose:\n+        print 'Writing state'\n     f = open(state, 'w')\n     pickle.dump(hgvers, f)\n \n-- \n1.5.5.GIT\n"},{"id":"77775","messageId":"bd6139dc0805260628l1b073f52i1f33bd0c707a4329@mail.gmail.com","threadId":"13670","inReplyTo":"alpine.DEB.1.00.0805261414140.30431@racer","subject":"Re: [PATCH] hg-to-git: add --verbose option","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-05-26T13:28:54Z","receivedAt":"2008-05-26T13:28:54Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Mon, May 26, 2008 at 3:14 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Now, that is not even funny, as that was my initial version, and Python\n> complained about not knowing \"false\".\n\nThat is because in python the keyword is \"False\" (note the capital 'F').\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"77780","messageId":"1211812380.12728.7.camel@galileo","threadId":"13670","inReplyTo":"alpine.DEB.1.00.0805261419440.30431@racer","subject":"Re: [PATCH v2] hg-to-git: add --verbose option","fromName":"Stelian Pop","fromEmail":"stelian@popies.net","sentAt":"2008-05-26T14:33:00Z","receivedAt":"2008-05-26T14:33:00Z","isPatch":true,"sender":{"key":"stelian@popies.net","avatar":"https://gravatar.com/avatar/c99e49c3b3d851deb85e4557b368712c890a09985211f183bd151f8ab6357c03?d=mp&s=160"},"body":"Le lundi 26 mai 2008 à 14:20 +0100, Johannes Schindelin a écrit :\n> This patch adds an option to make hg-to-git quiet by default.  Note:\n> it only suppresses those messages that would be printed when everything\n> was up-to-date.\n> \n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nAcked-by: Stelian Pop <stelian@popies.net>\n\nThanks, \n-- \nStelian Pop <stelian@popies.net>\n"},{"id":"77784","messageId":"7vlk1xc7aa.fsf@gitster.siamese.dyndns.org","threadId":"13670","inReplyTo":"bd6139dc0805260628l1b073f52i1f33bd0c707a4329@mail.gmail.com","subject":"Re: [PATCH] hg-to-git: add --verbose option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-26T17:19:25Z","receivedAt":"2008-05-26T17:19:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Sverre Rabbelier\" <alturin@gmail.com> writes:\n\n> On Mon, May 26, 2008 at 3:14 PM, Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n>> Now, that is not even funny, as that was my initial version, and Python\n>> complained about not knowing \"false\".\n>\n> That is because in python the keyword is \"False\" (note the capital 'F').\n\nI too write True/False in my recent Python code, but I vaguely recall they\nwere relatively new to the language.  I think it was 2.3 which is probably\n5 years old by now, so if that is the case we probably are safe (and they\nare used in p4import anyway).\n\nI think I spotted a bug in Python documentation, by the way ;-)\n\nhttp://docs.python.org/ref/ref.html does not even list \"True\" and \"False\"\nin its section 2.4 (Literals) yet, and that document is for version 2.5.2.\n"},{"id":"77799","messageId":"ee77f5c20805261429h14b1ce66tf9585132279c4f8e@mail.gmail.com","threadId":"13670","inReplyTo":"7vlk1xc7aa.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] hg-to-git: add --verbose option","fromName":"David Symonds","fromEmail":"dsymonds@gmail.com","sentAt":"2008-05-26T21:29:40Z","receivedAt":"2008-05-26T21:29:40Z","isPatch":true,"sender":{"key":"dsymonds@gmail.com","avatar":"https://gravatar.com/avatar/b22f5051cbfc11836e36cf7a690e6cde4e225d835e13295ff98d15c7a9ee3c0f?d=mp&s=160"},"body":"On Tue, May 27, 2008 at 3:19 AM, Junio C Hamano <gitster@pobox.com> wrote:\n\n> I think I spotted a bug in Python documentation, by the way ;-)\n>\n> http://docs.python.org/ref/ref.html does not even list \"True\" and \"False\"\n> in its section 2.4 (Literals) yet, and that document is for version 2.5.2.\n\nThat's because they aren't literals. They are, in fact, objects, and\nredefinable objects at that.\n\nTry:\n\nTrue=False\nprint True\n\n\n\nDave.\n"},{"id":"77805","messageId":"alpine.DEB.1.00.0805262247020.30431@racer","threadId":"13670","inReplyTo":"ee77f5c20805261429h14b1ce66tf9585132279c4f8e@mail.gmail.com","subject":"Re: [PATCH] hg-to-git: add --verbose option","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-26T21:47:47Z","receivedAt":"2008-05-26T21:47:47Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 27 May 2008, David Symonds wrote:\n\n> On Tue, May 27, 2008 at 3:19 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> \n> > I think I spotted a bug in Python documentation, by the way ;-)\n> >\n> > http://docs.python.org/ref/ref.html does not even list \"True\" and \n> > \"False\" in its section 2.4 (Literals) yet, and that document is for \n> > version 2.5.2.\n> \n> That's because they aren't literals. They are, in fact, objects, and \n> redefinable objects at that.\n> \n> Try:\n> \n> True=False\n> print True\n\nHey, I said that I had to code in Python until I do not hate it anymore!\n\nYou just made that task harder.\n\nThanks,\nDscho\n"}]}