From 89b7a1411e4658e831f5d635534b24355dbb941d Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 15 Dec 2009 06:44:20 -0500 Subject: 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. --- libbe/util/id.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libbe/util/id.py') diff --git a/libbe/util/id.py b/libbe/util/id.py index 3838259..adc827c 100644 --- a/libbe/util/id.py +++ b/libbe/util/id.py @@ -50,7 +50,7 @@ except ImportError: q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) else: # win32 don't have os.execvp() so have to run command in a shell - q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, + q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True, cwd=cwd) except OSError, e : strerror = "%s\nwhile executing %s" % (e.args[1], args) @@ -210,7 +210,7 @@ def child_uuids(child_storage_ids): fields = _split(id) if len(fields) == 1: yield fields[0] - + REGEXP = '#([-a-f0-9]*)(/[-a-g0-9]*)?(/[-a-g0-9]*)?#' @@ -298,7 +298,7 @@ if libbe.TESTING == True: self._siblings = siblings def sibling_uuids(self): return self._siblings - + class IDtestCase(unittest.TestCase): def setUp(self): self.bugdir = DummyObject('1234abcd') @@ -342,11 +342,11 @@ if libbe.TESTING == True: self.bug = DummyObject('abcdef', ['a1234', 'ab9876']) self.bug.bugdir = self.bugdir self.bugdir.bug_from_uuid = lambda uuid: self.bug - self.bugdir.uuids = lambda : self.bug.sibling_uuids() + [self.bug.uuid] + self.bugdir.uuids = lambda : self.bug.sibling_uuids() + [self.bug.uuid] self.comment = DummyObject('12345678', ['1234abcd', '1234cdef']) self.comment.bug = self.bug self.bug.comment_from_uuid = lambda uuid: self.comment - self.bug.uuids = lambda : self.comment.sibling_uuids() + [self.comment.uuid] + self.bug.uuids = lambda : self.comment.sibling_uuids() + [self.comment.uuid] self.bd_id = ID(self.bugdir, 'bugdir') self.b_id = ID(self.bug, 'bug') self.c_id = ID(self.comment, 'comment') -- cgit