aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage/vcs
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-15 06:44:20 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-15 06:44:20 -0500
commit89b7a1411e4658e831f5d635534b24355dbb941d (patch)
tree77f84979931ac4bf8bcf14d293154fe29e8491bc /libbe/storage/vcs
parent380889988b6d7881c4e0b5968053f85676d27211 (diff)
downloadbugseverywhere-89b7a1411e4658e831f5d635534b24355dbb941d.tar.gz
Fixed libbe.command.diff + ugly BugDir.duplicate_bugdir implementation
duplicate_bugdir() works, but for the vcs backends, it could require shelling out for _every_ file read. This could, and probably will, be horribly slow. Still it works ;). I'm not sure what a better implementation would be. The old implementation checked out the entire earlier state into a temporary directory pros: single shell out, simple upgrade implementation cons: wouldn't work well for HTTP backens I think a good solution would run along the lines of the currently commented out code in duplicate_bugdir(), where a VersionedStorage.changed_since(revision) call would give you a list of changed files. diff could work off of that directly, without the need to generate a whole duplicate bugdir. I'm stuck on how to handle upgrades though... Also removed trailing whitespace from all python files.
Diffstat (limited to 'libbe/storage/vcs')
-rw-r--r--libbe/storage/vcs/arch.py4
-rw-r--r--libbe/storage/vcs/base.py5
-rw-r--r--libbe/storage/vcs/bzr.py6
-rw-r--r--libbe/storage/vcs/darcs.py6
-rw-r--r--libbe/storage/vcs/git.py4
-rw-r--r--libbe/storage/vcs/hg.py2
6 files changed, 15 insertions, 12 deletions
diff --git a/libbe/storage/vcs/arch.py b/libbe/storage/vcs/arch.py
index 8afdca9..f1b5b7b 100644
--- a/libbe/storage/vcs/arch.py
+++ b/libbe/storage/vcs/arch.py
@@ -167,7 +167,7 @@ class Arch(base.VCS):
http://regexps.srparish.net/tutorial-tla/naming-conventions.html
Since our bug directory '.be' doesn't satisfy these conventions,
we need to adjust them.
-
+
The conventions are specified in
project-root/{arch}/=tagging-method
"""
@@ -211,7 +211,7 @@ class Arch(base.VCS):
dirname = path
status,output,error = self._u_invoke_client('tree-root', dirname)
root = output.rstrip('\n')
-
+
self._get_archive_project_name(root)
return root
diff --git a/libbe/storage/vcs/base.py b/libbe/storage/vcs/base.py
index 768a85f..3bdb4ac 100644
--- a/libbe/storage/vcs/base.py
+++ b/libbe/storage/vcs/base.py
@@ -195,6 +195,9 @@ class CachedPathID (object):
id = self.id(dirpath)
relpath = dirpath[len(self._root)+1:]
if id.count('/') == 0:
+ if id in self._cache:
+ import sys
+ print >> sys.stderr, 'Multiple paths for %s: \n %s\n %s' % (id, self._cache[id], relpath)
self._cache[id] = relpath
except InvalidPath:
pass
@@ -521,7 +524,7 @@ os.listdir(self.get_path("bugs")):
dumping VCS-specific files into the .be directory.
If you do need to implement this method (e.g. Arch), set
- self.interspersed_vcs_files = True
+ self.interspersed_vcs_files = True
"""
assert self.interspersed_vcs_files == False
raise NotImplementedError
diff --git a/libbe/storage/vcs/bzr.py b/libbe/storage/vcs/bzr.py
index 04cc6c1..6f3e840 100644
--- a/libbe/storage/vcs/bzr.py
+++ b/libbe/storage/vcs/bzr.py
@@ -49,7 +49,7 @@ class Bzr(base.VCS):
def _vcs_version(self):
status,output,error = self._u_invoke_client('--version')
- return output
+ return output
def _vcs_get_user_id(self):
status,output,error = self._u_invoke_client('whoami')
@@ -88,7 +88,7 @@ class Bzr(base.VCS):
return base.VCS._vcs_get_file_contents(self, path, revision)
else:
status,output,error = \
- self._u_invoke_client('cat', '-r', revision,path)
+ self._u_invoke_client('cat', '-r', revision, path)
return output
def _vcs_commit(self, commitfile, allow_empty=False):
@@ -123,7 +123,7 @@ class Bzr(base.VCS):
return str(index) # bzr commit 0 is the empty tree.
return str(current_revision+index+1)
-
+
if libbe.TESTING == True:
base.make_vcs_testcase_subclasses(Bzr, sys.modules[__name__])
diff --git a/libbe/storage/vcs/darcs.py b/libbe/storage/vcs/darcs.py
index 97e31ff..9a371d9 100644
--- a/libbe/storage/vcs/darcs.py
+++ b/libbe/storage/vcs/darcs.py
@@ -76,7 +76,7 @@ class Darcs(base.VCS):
def _vcs_detect(self, path):
if self._u_search_parent_directories(path, "_darcs") != None :
return True
- return False
+ return False
def _vcs_root(self, path):
"""Find the root of the deepest repository containing path."""
@@ -129,7 +129,7 @@ class Darcs(base.VCS):
'diff', '--unified', '--patch', revision, path,
unicode_output=False)
target_patch = output
-
+
# '--output -' to be supported in GNU patch > 2.5.9
# but that hasn't been released as of June 30th, 2009.
@@ -206,7 +206,7 @@ class Darcs(base.VCS):
except IndexError:
return None
-
+
if libbe.TESTING == True:
base.make_vcs_testcase_subclasses(Darcs, sys.modules[__name__])
diff --git a/libbe/storage/vcs/git.py b/libbe/storage/vcs/git.py
index 29abda7..8d1b529 100644
--- a/libbe/storage/vcs/git.py
+++ b/libbe/storage/vcs/git.py
@@ -76,7 +76,7 @@ class Git(base.VCS):
def _vcs_detect(self, path):
if self._u_search_parent_directories(path, '.git') != None :
return True
- return False
+ return False
def _vcs_root(self, path):
"""Find the root of the deepest repository containing path."""
@@ -154,7 +154,7 @@ class Git(base.VCS):
except IndexError:
return None
-
+
if libbe.TESTING == True:
base.make_vcs_testcase_subclasses(Git, sys.modules[__name__])
diff --git a/libbe/storage/vcs/hg.py b/libbe/storage/vcs/hg.py
index 7e0643b..d2d3281 100644
--- a/libbe/storage/vcs/hg.py
+++ b/libbe/storage/vcs/hg.py
@@ -124,7 +124,7 @@ class Hg(base.VCS):
return id
return None
-
+
if libbe.TESTING == True:
base.make_vcs_testcase_subclasses(Hg, sys.modules[__name__])