From dbfbd077cefbf45bc68491efc1218b9f04d812bc Mon Sep 17 00:00:00 2001 From: Christian Hammond Date: Wed, 24 Feb 2010 23:04:34 -0800 Subject: Fix two issues when using post-review with Subversion. First, using --revision-range with 0 wouldn't work, as the path given wouldn't have existed in revision 0. The repository path is now assumed if using revision 0, in order to get a diff of all the files. Second, sometimes an svn diff would have excess tabs in the diff file headers, which we wouldn't catch correctly. We now make sure to only split the headers into two groups, regardless of the number of tabs. Patch by Nathan Heijermans. Reviewed at http://reviews.reviewboard.org/r/1429/ --- AUTHORS | 1 + rbtools/postreview.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 39bf0b2..8c3f0d8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -21,6 +21,7 @@ Contributors: * Luke Robison * Matthew Woehlke * Mike Crute + * Nathan Heijermans * Paul Scott * Petr Novák * Raghu Kaippully diff --git a/rbtools/postreview.py b/rbtools/postreview.py index 330054c..99dcad3 100755 --- a/rbtools/postreview.py +++ b/rbtools/postreview.py @@ -1186,9 +1186,20 @@ class SVNClient(SCMClient): url = repository_info.path + repository_info.base_path - old_url = url + '@' + revisions[0] new_url = url + '@' + revisions[1] + # When the source revision is zero, assume the user wants to + # upload a diff containing all the files in ``base_path`` as new + # files. If the base path within the repository is added to both + # the old and new URLs, the ``svn diff`` command will error out + # since the base_path didn't exist at revision zero. To avoid + # that error, use the repository's root URL as the source for + # the diff. + if revisions[0] == "0": + url = repository_info.path + + old_url = url + '@' + revisions[0] + return self.do_diff(["svn", "diff", "--diff-cmd=diff", old_url, new_url] + files, repository_info) @@ -1309,8 +1320,9 @@ class SVNClient(SCMClient): if "\t" in s: # There's a \t separating the filename and info. This is the # best case scenario, since it allows for filenames with spaces - # without much work. - parts = s.split("\t") + # without much work. The info can also contain tabs after the + # initial one; ignore those when splitting the string. + parts = s.split("\t", 1) # There's spaces being used to separate the filename and info. # This is technically wrong, so all we can do is assume that -- cgit v1.2.3