[PATCH default] rebase: add missing EOL to debug strings

Martin Geisler mg at aragost.com
Wed May 2 07:30:21 CDT 2012


Patrick Mezard <patrick at mezard.eu> writes:

> # HG changeset patch
> # User Patrick Mezard <patrick at mezard.eu>
> # Date 1335951792 -7200
> # Branch stable
> # Node ID 65274bf8a0188507e2e46fe6efb473f21ec4f0c4
> # Parent  979b1b7340fba32b4d7f499e6d89093758147520
> rebase: add missing EOL to debug strings

Pushed as 9b7d2ff4b006.

> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -201,7 +201,7 @@
>                  root = None
>  
>              if not rebaseset:
> -                repo.ui.debug('base is ancestor of destination')
> +                repo.ui.debug('base is ancestor of destination\n')

I looked into creating a check-code rule for this -- just something that
would find simple cases like the above. This pattern

  r"""\.debug\((["']).*([^\\]n|\\[^n]|[^\\][^n])\1\)"""

seems to work okay with I test:

  >>> p = r"""\.debug\((["']).*([^\\]n|\\[^n]|[^\\][^n])\1\)"""
  >>> re.search(p, r'ui.debug("n\n")')
  >>> re.search(p, r'ui.debug("n\t")')
  <_sre.SRE_Match object at 0x7fc5d3378140>

The idea is that bad strings end with one of "[^\]n", "\[^n]", or
"[^\][^n]". Negative look ahead/behind assertions didn't work, I think
that's because the ".*" or ".*?" happily eats too much of the string.

However, I cannot get this pattern working as part of check-code. My
guess is that it's because of the extra processing it does on the
patterns.

-- 
Martin Geisler

aragost Trifork
Commercial Mercurial support
http://aragost.com/mercurial/


More information about the Mercurial-devel mailing list