[meld/VersionControlRework: 81/123] vc: Make update() not take files, and update svn and hg to new API



commit 391bff31bb9c12ef250cfdd47d929da932513859
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Apr 11 07:41:17 2015 +1000

    vc: Make update() not take files, and update svn and hg to new API

 meld/vc/_vc.py       |    5 +----
 meld/vc/bzr.py       |    2 +-
 meld/vc/git.py       |    2 +-
 meld/vc/mercurial.py |    5 +++--
 meld/vc/svn.py       |    5 +++--
 meld/vcview.py       |    7 ++-----
 6 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index e727d80..75dc5a0 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -121,9 +121,6 @@ class Vc(object):
         self._tree_cache = {}
         self._tree_meta_cache = {}
 
-    def update_command(self):
-        raise NotImplementedError()
-
     def add_command(self):
         raise NotImplementedError()
 
@@ -144,7 +141,7 @@ class Vc(object):
     def commit(self, runner, files, message):
         raise NotImplementedError()
 
-    def update(self, runner, files):
+    def update(self, runner):
         raise NotImplementedError()
 
     def push(self, runner):
diff --git a/meld/vc/bzr.py b/meld/vc/bzr.py
index bc745bb..3c98efc 100644
--- a/meld/vc/bzr.py
+++ b/meld/vc/bzr.py
@@ -106,7 +106,7 @@ class Vc(_vc.Vc):
             [self.CMD] + self.CMDARGS + ["push"], [], refresh=True,
             working_dir=self.root)
 
-    def update(self, runner, files):
+    def update(self, runner):
         # TODO: Handle checkouts/bound branches by calling
         # update instead of pull. For now we've replicated existing
         # functionality, as update will not work for unbound branches.
diff --git a/meld/vc/git.py b/meld/vc/git.py
index f1eed3f..7db8815 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -179,7 +179,7 @@ class Vc(_vc.Vc):
         command = [self.CMD, 'commit', '-m', message]
         runner(command, files, refresh=True, working_dir=self.root)
 
-    def update(self, runner, files):
+    def update(self, runner):
         command = [self.CMD, 'pull']
         runner(command, [], refresh=True, working_dir=self.root)
 
diff --git a/meld/vc/mercurial.py b/meld/vc/mercurial.py
index 3d43738..635c3ed 100644
--- a/meld/vc/mercurial.py
+++ b/meld/vc/mercurial.py
@@ -51,8 +51,9 @@ class Vc(_vc.Vc):
         command = [self.CMD, 'commit', '-m', message]
         runner(command, [], refresh=True, working_dir=self.root)
 
-    def update_command(self):
-        return [self.CMD, "update"]
+    def update(self, runner):
+        command = [self.CMD, 'pull', '-u']
+        runner(command, [], refresh=True, working_dir=self.root)
 
     def add_command(self):
         return [self.CMD, "add"]
diff --git a/meld/vc/svn.py b/meld/vc/svn.py
index b5bd409..2454e7c 100644
--- a/meld/vc/svn.py
+++ b/meld/vc/svn.py
@@ -56,8 +56,9 @@ class Vc(_vc.Vc):
         command = [self.CMD, 'commit', '-m', message]
         runner(command, [], refresh=True, working_dir=self.root)
 
-    def update_command(self):
-        return [self.CMD,"update"]
+    def update(self, runner):
+        command = [self.CMD, 'update']
+        runner(command, [], refresh=True, working_dir=self.root)
 
     def remove_command(self, force=0):
         return [self.CMD,"rm","--force"]
diff --git a/meld/vcview.py b/meld/vcview.py
index 1c25f8e..6315b48 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -156,7 +156,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
     # Map action names to VC commands and required arguments list
     action_vc_cmds_map = {
         "VcCommit": ("commit", (lambda *args, **kwargs: None, [], "")),
-        "VcUpdate": ("update_command", ()),
+        "VcUpdate": ("update", (lambda *args, **kwargs: None, )),
         "VcPush": ("push", (lambda *args, **kwargs: None, )),
         "VcAdd": ("add_command", ()),
         "VcResolved": ("resolve", (lambda *args, **kwargs: None, [])),
@@ -689,10 +689,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
             self._command(command, files, refresh)
 
     def on_button_update_clicked(self, obj):
-        try:
-            self.vc.update(self._command, self._get_selected_files())
-        except NotImplementedError:
-            self._command_on_selected(self.vc.update_command())
+        self.vc.update(self._command)
 
     def on_button_push_clicked(self, obj):
         response = vcdialogs.PushDialog(self).run()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]