From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGIT PATCH 4/4] Compile regexp just once
Date: Sun, 26 Aug 2007 22:26:32 +0200 [thread overview]
Message-ID: <20070826202632.15933.99722.stgit@yoghurt> (raw)
In-Reply-To: <20070826202309.15933.54183.stgit@yoghurt>
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 | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/stgit/git.py b/stgit/git.py
index 1807f69..14b4c81 100644
--- 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
next prev parent reply other threads:[~2007-08-26 20:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-26 20:26 [StGIT PATCH 0/4] Miscellaneous fixes Karl Hasselström
2007-08-26 20:26 ` [StGIT PATCH 1/4] Don't use test_expect_failure when more than one thing could fail Karl Hasselström
2007-08-26 20:26 ` [StGIT PATCH 2/4] Don't write None to the conf file Karl Hasselström
2007-08-26 20:26 ` [StGIT PATCH 3/4] Replace "git repo-config" with "git config" in help texts Karl Hasselström
2007-08-26 20:26 ` Karl Hasselström [this message]
2007-08-29 10:18 ` [StGIT PATCH 0/4] Miscellaneous fixes Catalin Marinas
2007-08-29 11:17 ` Karl Hasselström
2007-09-03 8:40 ` Catalin Marinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070826202632.15933.99722.stgit@yoghurt \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).