[meld] vc.git: Move status regex to class level
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] vc.git: Move status regex to class level
- Date: Fri, 27 Sep 2013 22:05:32 +0000 (UTC)
commit 4407c70979abbfb95e86982625d7b8cfe7b5135a
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Aug 18 09:38:59 2013 +1000
vc.git: Move status regex to class level
meld/vc/git.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/meld/vc/git.py b/meld/vc/git.py
index 59e245f..ca06e0e 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -42,10 +42,12 @@ class Vc(_vc.CachedVc):
CMD = "git"
NAME = "Git"
VC_DIR = ".git"
- GIT_DIFF_FILES_RE = ":(\d+) (\d+) [a-z0-9]+ [a-z0-9]+ ([ADMU])\t(.*)"
VC_COLUMNS = (_vc.DATA_NAME, _vc.DATA_STATE, _vc.DATA_OPTIONS)
+ GIT_DIFF_FILES_RE = ":(\d+) (\d+) [a-z0-9]+ [a-z0-9]+ ([ADMU])\t(.*)"
+ DIFF_RE = re.compile(GIT_DIFF_FILES_RE)
+
conflict_map = {
# These are the arguments for git-show
# CONFLICT_MERGED has no git-show argument unfortunately.
@@ -65,7 +67,6 @@ class Vc(_vc.CachedVc):
def __init__(self, location):
super(Vc, self).__init__(location)
- self.diff_re = re.compile(self.GIT_DIFF_FILES_RE)
self._tree_cache = {}
self._tree_meta_cache = {}
@@ -164,7 +165,7 @@ class Vc(_vc.CachedVc):
for p in paths:
if os.path.isdir(p):
entries = self._get_modified_files(p)
- names = [self.diff_re.search(e).groups()[3] for e in entries]
+ names = [self.DIFF_RE.search(e).groups()[3] for e in entries]
files.extend(names)
else:
files.append(os.path.relpath(p, self.root))
@@ -330,7 +331,7 @@ class Vc(_vc.CachedVc):
else:
# There are 1 or more modified files, parse their state
for entry in entries:
- columns = self.diff_re.search(entry).groups()
+ columns = self.DIFF_RE.search(entry).groups()
old_mode, new_mode, statekey, name = columns
if os.name == 'nt':
# Git returns unix-style paths on Windows
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]