git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] make hg-to-git compatible with python2.x and 3.x

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 15, 2018, 22:06 UTC
Message-ID
<xmqq4lmh9abk.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<01020161992fe7ce-b41bf370-1480-4efe-8980-0c52fb9b9be5-000000@eu-west-1.amazonses.com>
Hervé Beraud <herveberaud.pro@gmail.com> writes:
> ---

Thanks for posting, but this is way under-justified, even for something in contrib/ area.

Are all changes in this patch necessary to "make it compatible with both Python 2 and 3", or are some parts do not contribute directly to the objective but are good changes to suit your personal taste, match BCP styles, etc.? I am guessing it is the latter (e.g. with Python 3, you cannot use print without invoking it as a function, but os.system() can still accept a literal command line string, so introducing variable "rm_f" that gets assigned a literal string only once to pass it to os.system() does not have anything to do with the Python2to3 transition), and if that is the case, it makes sense to split this into at least 2 patches, i.e. prelimiary clean-up, followed by changes required to run it with Python3. It also is OK to make it a 3-patch series, in which case you would limit the preliminary clean-up to minimum uncontroversial changes and follow up with an optional update to suit personal taste at the very end.

Also, the submission needs to be signed-off for us to be able to use. Please see Documentation/SubmittingPatches for details.

Thanks.
Show 23 quoted lines
>  contrib/hg-to-git/hg-to-git.py | 140 ++++++++++++++++++++++++-----------------
>  1 file changed, 83 insertions(+), 57 deletions(-)
>
> diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
> ...
>      os.system('git ls-files -x .hg --others | git update-index --add --stdin')
>      # delete removed files
> -    os.system('git ls-files -x .hg --deleted | git update-index --remove --stdin')
> +    rm_f = 'git ls-files -x .hg --deleted | git update-index --remove --stdin'
> +    os.system(rm_f)
>  ... 
> @@ -247,7 +273,7 @@ def getgitenv(user, date):
>  # write the state for incrementals
>  if state:
>      if verbose:
> -        print 'Writing state'
> +        print('Writing state')
>      f = open(state, 'w')
>      pickle.dump(hgvers, f)
>  
>
> --
> https://github.com/git/git/pull/458
Previous: Hervé BeraudNext: Hervé Beraud
Message 2 of 11 in “make hg-to-git compatible with python2.x and 3.x”
  1. make hg-to-git compatible with python2.x and 3.xHervé Beraud, Feb 15, 2018
  2. Junio C HamanoFeb 15, 2018
  3. make hg-to-git compatible with python2.x and 3.xHervé Beraud, Feb 20, 2018
  4. Junio C HamanoFeb 20, 2018
  5. Junio C HamanoFeb 20, 2018
  6. Rewrite feature to render hg-to-git compatible with python2.x and 3.xHervé Beraud, Sep 17, 2019
  7. Junio C HamanoSep 17, 2019
  8. Junio C HamanoSep 17, 2019
  9. hg-to-git: make it compatible with both python3 and python2Hervé Beraud, Sep 18, 2019
  10. Junio C HamanoSep 18, 2019
  11. hg-to-git: make it compatible with both python3 and python2Hervé Beraud, Sep 18, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.