chiark
/
gitweb
/
~mdw
/
stgit
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
82792b4
)
Compile regexp just once
author
Karl Hasselström
<kha@treskal.com>
Sat, 25 Aug 2007 18:10:38 +0000
(20:10 +0200)
committer
Karl Hasselström
<kha@treskal.com>
Sun, 26 Aug 2007 19:55:37 +0000
(21:55 +0200)
It's a waste of time to recompile the same regexp every time we go
through the loop.
Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/git.py
patch
|
blob
|
blame
|
history
diff --git
a/stgit/git.py
b/stgit/git.py
index 1807f69f2af2421ea69f707044471dc3a986e0b3..14b4c81a36f24ec6b56b215be2e3125102ba34af 100644
(file)
--- a/
stgit/git.py
+++ b/
stgit/git.py
@@
-275,8
+275,9
@@
def local_changes(verbose = True):
def get_heads():
heads = []
+ hr = re.compile(r'^[0-9a-f]{40} refs/heads/(.+)$')
for line in _output_lines(['git-show-ref', '--heads']):
- m =
re.match('^[0-9a-f]{40} refs/heads/(.+)$',
line)
+ m =
hr.match(
line)
heads.append(m.group(1))
return heads