Patchwork [2,of,2] histedit: use str.startswith to check for comments in action list

login
register
mail settings
Submitter adgar@google.com
Date Aug. 22, 2014, 8:47 p.m.
Message ID <df02780e56f269f41442.1408740441@adgar.nyc.corp.google.com>
Download mbox | patch
Permalink /patch/5555/
State Accepted
Headers show

Comments

adgar@google.com - Aug. 22, 2014, 8:47 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1408740034 14400
#      Fri Aug 22 16:40:34 2014 -0400
# Node ID df02780e56f269f41442dc4c7b98776dada7d8ff
# Parent  3e73eb37f5c8b6a837983c5f9d505ac4cfade546
histedit: use str.startswith to check for comments in action list
Matt Mackall - Aug. 22, 2014, 10:44 p.m.
On Fri, 2014-08-22 at 16:47 -0400, adgar@google.com wrote:
> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1408740034 14400
> #      Fri Aug 22 16:40:34 2014 -0400
> # Node ID df02780e56f269f41442dc4c7b98776dada7d8ff
> # Parent  3e73eb37f5c8b6a837983c5f9d505ac4cfade546
> histedit: use str.startswith to check for comments in action list

These are queued for default, thanks.
Matt Mackall - Aug. 26, 2014, 10 a.m.
On Fri, 2014-08-22 at 16:47 -0400, adgar@google.com wrote:
> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1408740034 14400
> #      Fri Aug 22 16:40:34 2014 -0400
> # Node ID df02780e56f269f41442dc4c7b98776dada7d8ff
> # Parent  3e73eb37f5c8b6a837983c5f9d505ac4cfade546
> histedit: use str.startswith to check for comments in action list
> 
> diff -r 3e73eb37f5c8 -r df02780e56f2 hgext/histedit.py
> --- a/hgext/histedit.py	Fri Aug 22 16:37:55 2014 -0400
> +++ b/hgext/histedit.py	Fri Aug 22 16:40:34 2014 -0400
> @@ -610,7 +610,7 @@
>              rules = f.read()
>              f.close()
>          rules = [l for l in (r.strip() for r in rules.splitlines())
> -                 if l and not l[0] == '#']
> +                 if not l.startswith('#')]

FYI, this obviously-correct change breaks seven tests! You might find
run-tests.py -k histedit helpful.

Looks like the "l and" piece is actually doing more than it looks like,
I've added it back in flight.

Patch

diff -r 3e73eb37f5c8 -r df02780e56f2 hgext/histedit.py
--- a/hgext/histedit.py	Fri Aug 22 16:37:55 2014 -0400
+++ b/hgext/histedit.py	Fri Aug 22 16:40:34 2014 -0400
@@ -610,7 +610,7 @@ 
             rules = f.read()
             f.close()
         rules = [l for l in (r.strip() for r in rules.splitlines())
-                 if l and not l[0] == '#']
+                 if not l.startswith('#')]
         rules = verifyrules(rules, repo, ctxs)
 
         parentctx = repo[root].parents()[0]