aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage/vcs/hg.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2010-01-18 12:25:17 -0500
committerW. Trevor King <wking@drexel.edu>2010-01-18 12:25:17 -0500
commit7ae29f930fe73adada5174a2ce74266411809ac7 (patch)
treeae850b985fab14974d3eca393907cc3a098156fa /libbe/storage/vcs/hg.py
parentc7945daa3e1413b7c789df182b39c12dfbe2b4db (diff)
downloadbugseverywhere-7ae29f930fe73adada5174a2ce74266411809ac7.tar.gz
Added VCS._u_find_id_from_manifest for faster id->path calculation
Diffstat (limited to 'libbe/storage/vcs/hg.py')
-rw-r--r--libbe/storage/vcs/hg.py20
1 files changed, 3 insertions, 17 deletions
diff --git a/libbe/storage/vcs/hg.py b/libbe/storage/vcs/hg.py
index 824f687..5295a57 100644
--- a/libbe/storage/vcs/hg.py
+++ b/libbe/storage/vcs/hg.py
@@ -112,23 +112,9 @@ class Hg(base.VCS):
return self._u_invoke_client('cat', '-r', revision, path)
def _vcs_path(self, id, revision):
- output = self._u_invoke_client('manifest', '--rev', revision)
- be_dir = self._cached_path_id._spacer_dirs[0]
- be_dir_sep = self._cached_path_id._spacer_dirs[0] + os.path.sep
- files = [f for f in output.splitlines() if f.startswith(be_dir_sep)]
- for file in files:
- if not file.startswith(be_dir+os.path.sep):
- continue
- parts = file.split(os.path.sep)
- dir = parts.pop(0) # don't add the first spacer dir
- for part in parts[:-1]:
- dir = os.path.join(dir, part)
- if not dir in files:
- files.append(dir)
- for file in files:
- if self._u_path_to_id(file) == id:
- return file
- raise base.InvalidId(id, revision=revision)
+ manifest = self._u_invoke_client(
+ 'manifest', '--rev', revision).splitlines()
+ return self._u_find_id_from_manifest(id, manifest, revision=revision)
def _vcs_isdir(self, path, revision):
output = self._u_invoke_client('manifest', '--rev', revision)