[meld] Make Git 'update' command (pull) path-less (bgo#698564)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Make Git 'update' command (pull) path-less (bgo#698564)
- Date: Sat, 27 Apr 2013 05:06:31 +0000 (UTC)
commit 03012e4d3843ff1c855747f6e1347ed23e6be8de
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Apr 27 14:27:32 2013 +1000
Make Git 'update' command (pull) path-less (bgo#698564)
Since it's not actually possible to do this under the existing VC
interaction model, this commit includes the start of a new interface
to the VC modules. In this interface, the command is called by the
VC module, which is passed a 'runner' - essentially just a method
that takes a command list and a files list and runs the result.
The runner interface will probably have to change to require a
subprocess-style list of all arguments, but the current way is much
easier to hook in to existing code.
meld/vc/git.py | 6 ++++++
meld/vcview.py | 5 ++++-
2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/meld/vc/git.py b/meld/vc/git.py
index 382c761..c8a1cf6 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -90,6 +90,12 @@ class Vc(_vc.CachedVc):
def revert_command(self):
return [self.CMD,"checkout"]
+ # Prototyping VC interface version 2
+
+ def update(self, runner, files):
+ command = [self.CMD, 'pull']
+ runner(command, [], refresh=True, working_dir=self.root)
+
def get_path_for_conflict(self, path, conflict):
if not path.startswith(self.root + os.path.sep):
raise _vc.InvalidVCPath(self, path, "Path not in repository")
diff --git a/meld/vcview.py b/meld/vcview.py
index 83e4e99..0a30cd8 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -682,7 +682,10 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
self._command(command, files, refresh)
def on_button_update_clicked(self, obj):
- self._command_on_selected(self.vc.update_command())
+ try:
+ self.vc.update(self._command, self._get_selected_files())
+ except AttributeError:
+ self._command_on_selected(self.vc.update_command())
def on_button_commit_clicked(self, obj):
CommitDialog(self).run()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]