[PATCH resend] convert: teach cvsps to handle . repository [issue 1649]

Patrick Mézard pmezard at gmail.com
Sat Mar 13 12:23:27 CST 2010


Le 09/03/10 12:11, Mathieu Clabaut a écrit :
> # HG changeset patch
> # User Mathieu Clabaut <mathieu.clabaut at systerel.fr>
> # Date 1268132997 -3600
> # Node ID 707027328bd6f16ce762f5200ab8df4348911495
> # Parent  261cc6b0f15c7e83dcff7dd7d5f3607c098c29bd
> convert: teach cvsps to handle . repository [issue 1649]
> 
> For a CVS repository checked out with "cvs co .", the prefix used to strip of
> what we get from CVS was previously erroneously set to "repopath/.".
> We now prevent the dot to be added.
> 
> diff -r 261cc6b0f15c -r 707027328bd6 hgext/convert/cvsps.py
> --- a/hgext/convert/cvsps.py	Thu Feb 18 23:23:17 2010 -0600
> +++ b/hgext/convert/cvsps.py	Tue Mar 09 12:09:57 2010 +0100
> @@ -124,9 +124,9 @@
>          # Get the real directory in the repository
>          try:
>              prefix = open(os.path.join('CVS','Repository')).read().strip()
> +            directory = prefix
>              if prefix == ".":
>                  prefix = ""
> -            directory = prefix
>          except IOError:
>              raise logerror('Not a CVS sandbox')

Is this hunk necessary? The test pass here without it (for some definition of pass, my cvs 1.12.13 generates more file in CVSROOT than yours it seems which changes the output a bit, but I can work around this).

That's the only thing preventing me from pushing it.

>  
> @@ -184,7 +184,10 @@
>          p = util.normpath(getrepopath(root))
>          if not p.endswith('/'):
>              p += '/'
> -        prefix = p + util.normpath(prefix)
> +        if prefix != "": # looks like normpath replaces "" by "."
> +            prefix = p + util.normpath(prefix)
> +        else:
> +            prefix = p

I have rewritten this like:

if prefix:
    blah ...

>      cmd.append(['log', 'rlog'][rlog])
>      if date:
>          # no space between option and date string
> diff -r 261cc6b0f15c -r 707027328bd6 tests/test-convert-cvs-dot
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/tests/test-convert-cvs-dot	Tue Mar 09 12:09:57 2010 +0100

I have fold this test into test-convert-cvs.

--
Patrick Mézard


More information about the Mercurial-devel mailing list