[meld/VersionControlRework: 96/123] vc._vc, vcview: Fix cross-tab command API presence checks
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/VersionControlRework: 96/123] vc._vc, vcview: Fix cross-tab command API presence checks
- Date: Sun, 19 Apr 2015 20:14:04 +0000 (UTC)
commit 23fc420ff85ca515728a01f581df13d388da2bf9
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Apr 11 09:46:55 2015 +1000
vc._vc, vcview: Fix cross-tab command API presence checks
This commit removes out empty interface-alike implementations for VC
command API, and then uses simple attribute checking to handle the
new-ish cross-tab command API.
meld/vc/_vc.py | 21 ---------------------
meld/vcview.py | 10 ++--------
2 files changed, 2 insertions(+), 29 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index a4eb50c..aa91f60 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -141,30 +141,9 @@ class Vc(object):
def get_commit_message_prefill(self):
return None
- def commit(self, runner, files, message):
- raise NotImplementedError()
-
- def update(self, runner):
- raise NotImplementedError()
-
- def push(self, runner):
- raise NotImplementedError()
-
- def revert(self, runner, files):
- raise NotImplementedError()
-
def get_commits_to_push_summary(self):
raise NotImplementedError()
- def add(self, runner, files):
- raise NotImplementedError()
-
- def remove(self, runner, files):
- raise NotImplementedError()
-
- def resolve(self, runner, files):
- raise NotImplementedError()
-
def get_valid_actions(self, path_states):
"""Get the set of valid actions for paths with version states
diff --git a/meld/vcview.py b/meld/vcview.py
index b38ae5d..57dfbef 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -610,14 +610,8 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
yield workdir, r
def has_command(self, command):
- # Because of the way we've chosen to implement the newer command API,
- # it's very very hard to determine whether a plugin implements a call
- # at this point. We're using whether a plugin has been updated to the
- # new API as a proxy for understanding these commands, since right now
- # that happens to work... this is bad.
- # FIXME: This is now even more broken than it was already
- uses_new_api = hasattr(self.vc, 'update_actions_for_paths')
- return uses_new_api and command in self.command_map
+ vc_command = self.command_map.get(command)
+ return vc_command and hasattr(self.vc, vc_command)
def command(self, command, files):
if not self.has_command(command):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]