[meld] Move workaround into the Vc class, for future replacement
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Move workaround into the Vc class, for future replacement
- Date: Fri, 21 Jun 2013 22:04:51 +0000 (UTC)
commit 4dd182f88d52ee090cf003d5e9ddb94b84dbb73e
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Jun 22 07:42:55 2013 +1000
Move workaround into the Vc class, for future replacement
meld/vc/_vc.py | 16 ++++++++++++++++
meld/vcview.py | 10 +---------
2 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index 3fc839b..46b8cf4 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -248,6 +248,22 @@ class Vc(object):
def _get_dirsandfiles(self, directory, dirs, files):
raise NotImplementedError()
+ def get_entry(self, path):
+ """Return the entry associated with the given path in this VC
+
+ If the given path does not correspond to any entry in the VC, this
+ method returns return None.
+ """
+ vc_files = [
+ x for x in
+ self.lookup_files(
+ [], [(os.path.basename(path), path)])[1]
+ if x.path == path
+ ]
+ if not vc_files:
+ return None
+ return vc_files[0]
+
class CachedVc(Vc):
diff --git a/meld/vcview.py b/meld/vcview.py
index 205bc18..86879bb 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -498,15 +498,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
continue
kwargs = {}
- # Horrible workaround here - lookup_files is not guaranteed
- # to *only* contain the path in question.
- vc_files = [
- x for x in
- self.vc.lookup_files(
- [], [(os.path.basename(path), path)])[1]
- if x.path == path
- ]
- if vc_files and vc_files[0].state == tree.STATE_CONFLICT and \
+ if self.vc.get_entry(path).state == tree.STATE_CONFLICT and \
hasattr(self.vc, 'get_path_for_conflict'):
# We use auto merge, so we create a new temp file
# for other, base and this, then set the output to
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]