Commit 7c5f4706 authored by Vincent Legoll's avatar Vincent Legoll

Revert r1209, r1210, r1211, as they broke VC plugins

when diffing files not at repository root.

svn path=/trunk/; revision=1267
parent c17118c6
...@@ -100,6 +100,9 @@ class Vc(object): ...@@ -100,6 +100,9 @@ class Vc(object):
start = tmp start = tmp
raise ValueError() raise ValueError()
def get_working_directory(self, workdir):
return workdir
def cache_inventory(self, topdir): def cache_inventory(self, topdir):
pass pass
......
...@@ -50,6 +50,8 @@ class Vc(_vc.Vc): ...@@ -50,6 +50,8 @@ class Vc(_vc.Vc):
return [self.CMD,"rm"] return [self.CMD,"rm"]
def revert_command(self): def revert_command(self):
return [self.CMD,"revert"] return [self.CMD,"revert"]
def get_working_directory(self, workdir):
return self.root
def cache_inventory(self, rootdir): def cache_inventory(self, rootdir):
self._tree_cache = self.lookup_tree(rootdir) self._tree_cache = self.lookup_tree(rootdir)
......
...@@ -71,6 +71,9 @@ class Vc(_vc.Vc): ...@@ -71,6 +71,9 @@ class Vc(_vc.Vc):
# will not work, since darcs needs interaction it seems # will not work, since darcs needs interaction it seems
return [self.CMD, "revert", "-a"] return [self.CMD, "revert", "-a"]
def get_working_directory(self, workdir):
return self.root
def cache_inventory(self, rootdir): def cache_inventory(self, rootdir):
self._cached_statuses = self._calculate_statuses() self._cached_statuses = self._calculate_statuses()
......
...@@ -62,6 +62,11 @@ class Vc(_vc.Vc): ...@@ -62,6 +62,11 @@ class Vc(_vc.Vc):
return [self.CMD,"rm"] return [self.CMD,"rm"]
def revert_command(self): def revert_command(self):
return [self.CMD,"checkout"] return [self.CMD,"checkout"]
def get_working_directory(self, workdir):
if workdir.startswith("/"):
return self.root
else:
return ''
def cache_inventory(self, topdir): def cache_inventory(self, topdir):
self._tree_cache = self.lookup_tree() self._tree_cache = self.lookup_tree()
......
...@@ -45,6 +45,8 @@ class Vc(_vc.Vc): ...@@ -45,6 +45,8 @@ class Vc(_vc.Vc):
return [self.CMD,"rm"] return [self.CMD,"rm"]
def revert_command(self): def revert_command(self):
return [self.CMD,"revert"] return [self.CMD,"revert"]
def get_working_directory(self, workdir):
return self.root
def _get_dirsandfiles(self, directory, dirs, files): def _get_dirsandfiles(self, directory, dirs, files):
......
...@@ -65,6 +65,8 @@ class Vc(_vc.Vc): ...@@ -65,6 +65,8 @@ class Vc(_vc.Vc):
return [self.CMD,"drop"] return [self.CMD,"drop"]
def revert_command(self): def revert_command(self):
return [self.CMD,"revert"] return [self.CMD,"revert"]
def get_working_directory(self, workdir):
return self.root
def cache_inventory(self, rootdir): def cache_inventory(self, rootdir):
self._tree_cache = self.lookup_tree() self._tree_cache = self.lookup_tree()
......
...@@ -89,6 +89,9 @@ class Vc(_vc.Vc): ...@@ -89,6 +89,9 @@ class Vc(_vc.Vc):
# Will only work on later versions of tla # Will only work on later versions of tla
return [self.CMD, "undo", "--"] return [self.CMD, "undo", "--"]
def get_working_directory(self, workdir):
return self.root
def cache_inventory(self, rootdir): def cache_inventory(self, rootdir):
self._cached_statuses = self._calculate_statuses() self._cached_statuses = self._calculate_statuses()
......
...@@ -369,9 +369,9 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component): ...@@ -369,9 +369,9 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
kill = len(pbase) and (len(pbase)+1) or 0 kill = len(pbase) and (len(pbase)+1) or 0
return p[kill:] or "." return p[kill:] or "."
if len(files) == 1 and os.path.isdir(files[0]): if len(files) == 1 and os.path.isdir(files[0]):
workdir = files[0] workdir = self.vc.get_working_directory(files[0])
else: else:
workdir = _commonprefix(files) workdir = self.vc.get_working_directory( _commonprefix(files) )
files = [ relpath(workdir, f) for f in files ] files = [ relpath(workdir, f) for f in files ]
r = None r = None
self.consolestream.write( misc.shelljoin(command+files) + " (in %s)\n" % workdir) self.consolestream.write( misc.shelljoin(command+files) + " (in %s)\n" % workdir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment