From d2133965cecce9b4703ef15f6533fb89d3e2e859 Mon Sep 17 00:00:00 2001 From: chipx86 Date: Thu, 28 May 2009 10:19:52 +0000 Subject: Patch by Steven Russell to fix working with Perforce file paths containing spaces. Fixes bug #840. Reviewed at http://reviews.review-board.org/r/815/ --- AUTHORS | 1 + scripts/post-review | 18 +++++------------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/AUTHORS b/AUTHORS index 146d96d..390306e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -14,3 +14,4 @@ Contributors: * Paul Scott * Raghu Kaippully * Stacey Sheldon + * Steven Russell diff --git a/scripts/post-review b/scripts/post-review index 6f8944a..e024cdd 100755 --- a/scripts/post-review +++ b/scripts/post-review @@ -1707,19 +1707,11 @@ class PerforceClient(SCMClient): def _depot_to_local(self, depot_path): """ Given a path in the depot return the path on the local filesystem to - the same file. - """ - # $ p4 where //user/bvanzant/main/testing - # //user/bvanzant/main/testing //bvanzant:test05:home/testing /home/bvanzant/home-versioned/testing - where_output = execute(["p4", "where", depot_path], split_lines=True) - # Take only the last line from the where command. If you have a - # multi-line view mapping with exclusions, Perforce will display - # the exclusions in order, with the last line showing the actual - # location. - last_line = where_output[-1].strip() - - # XXX: This breaks on filenames with spaces. - return last_line.split(' ')[2].rstrip() + the same file. If there are multiple results, take only the last + result from the where command. + """ + where_output = self._run_p4(['where', depot_path]) + return where_output[-1]['path'] class MercurialClient(SCMClient): -- cgit v1.2.3