1874: post-review does not properly parse diffs between commits in a branch on a git-svn repository

jor***@gmai***** (Google Code) (Is this you? Claim this profile.)
Aug. 10, 2013
What version are you running?
RBTools 0.2

What's the URL of the page containing the problem?
n/a

What steps will reproduce the problem?
on a git-svn repository, do the following
1. git checkout -b new_feature git-svn
2. touch foo.txt
3. git add foo.txt
4. git commit -a -m "change 1"
5. echo "hi" > foo.txt
6. git commit -a -m "change 2"
7. post-review -n --parent=HEAD^

What is the expected output? What do you see instead?
Expected is the same as git diff --full-index HEAD^
diff --git a/foo.txt b/foo.txt
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..45b983be36b73c0788dc9cbcb76cbb80
--- a/foo.txt
+++ b/foo.txt
@@ -0,0 +1 @@
+hi

Instead, this happens:
> post-review -n --parent=HEAD^
None
>


What operating system are you using? What browser?
OS: Ubuntu 10.04 Desktop / Linux 2.6.32-25-generic
Browser: n/a
david
#1 david
Can you run with --debug and give us the output?
  • +NeedInfo
  • +Component-RBTools
#2 jor***@gmai***** (Google Code) (Is this you? Claim this profile.)
> post-review --debug -n --parent=HEAD^
>>> svn info
>>> git rev-parse --git-dir
>>> git symbolic-ref -q HEAD
>>> git svn info
>>> repository info: Path: ****, Base path: ***, Supports changesets: False
>>> git config --get reviewboard.url
>>> git merge-base HEAD^ refs/heads/test
>>> git diff --no-color --no-prefix -r -u HEAD^..
>>> git svn find-rev HEAD^
>>> git diff --no-color --no-prefix -r -u 876661497ba5664a7d3b1a2fa7b7232e75ffe643..HEAD^
>>> git svn find-rev 876661497ba5664a7d3b1a2fa7b7232e75ffe643
>>> git log --pretty=format:%s HEAD^..
>>> git log --pretty=format:%s%n%n%b HEAD^..
None
#3 jor***@gmai***** (Google Code) (Is this you? Claim this profile.)
> post-review --debug -n --parent=HEAD^
>>> svn info
>>> git rev-parse --git-dir
>>> git symbolic-ref -q HEAD
>>> git svn info
>>> repository info: Path: ****, Base path: ***, Supports changesets: False
>>> git config --get reviewboard.url
>>> git merge-base HEAD^ refs/heads/test
>>> git diff --no-color --no-prefix -r -u HEAD^..
>>> git svn find-rev HEAD^
>>> git diff --no-color --no-prefix -r -u 876661497ba5664a7d3b1a2fa7b7232e75ffe643..HEAD^
>>> git svn find-rev 876661497ba5664a7d3b1a2fa7b7232e75ffe643
>>> git log --pretty=format:%s HEAD^..
>>> git log --pretty=format:%s%n%n%b HEAD^..
None
david
#4 david
  • -NeedInfo
    +New
#5 kog****@gmai***** (Google Code) (Is this you? Claim this profile.)
This is also a problem in 0.3.2


post-review --parent=rb4859posted --debug -n
>>> RBTools 0.3.2
>>> Home = /Users/jsmith
>>> svn info
>>> git rev-parse --git-dir
>>> git symbolic-ref -q HEAD
>>> git svn info
>>> repository info: Path: ********, Base path:**********, Supports changesets: False
>>> HTTP GETting api/
>>> HTTP GETting http://**********/api/info/
>>> Using the new web API
>>> git merge-base rb4859posted refs/heads/testing
>>> git diff --no-color --no-prefix --no-ext-diff -r -u rb4859posted..
>>> git svn find-rev rb4859posted
>>> git diff --no-color --no-prefix --no-ext-diff -r -u ab8549308482f656fa0e50562bd2ea19b63bc0f4..rb4859posted
>>> git svn find-rev ab8549308482f656fa0e50562bd2ea19b63bc0f4
Traceback (most recent call last):
  File "/usr/local/bin/post-review", line 8, in <module>
    load_entry_point('RBTools==0.3.2', 'console_scripts', 'post-review')()
  File "/Library/Python/2.6/site-packages/RBTools-0.3.2-py2.6.egg/rbtools/postreview.py", line 3769, in main
TypeError: object of type 'NoneType' has no len()
#6 tbe****@gmai***** (Google Code) (Is this you? Claim this profile.)
I also had this same problem.  The problem is due to the diff being for a file that doesn't exist in SVN yet.  I have created the attached patch and use it like this:

post-review --revision-range HEAD^:HEAD

or whatever the range is (HEAD^^:HEAD to include the last two commits for instance).
This patch is against rbtools 0.4.2.
  • +
    --- rbtools/clients/git.py.orig	2012-03-22 13:13:44.000000000 -0400
    +++ rbtools/clients/git.py	2012-03-22 13:14:25.000000000 -0400
    @@ -277,7 +277,11 @@ class GitClient(SCMClient):
             rev = execute([self.git, "svn", "find-rev", parent_branch]).strip()
     
             if not rev:
    -            return None
    +            merge_base = execute([self.git, "merge-base", self.upstream_branch,
    +                                  parent_branch]).strip()
    +            rev = execute([self.git, "svn", "find-rev", merge_base]).strip()
    +            if not rev:
    +                return None
     
             diff_data = ""
             filename = ""
#7 fr***@thefound******** (Google Code) (Is this you? Claim this profile.)
kognate's patch fixes my issues (exactly as described by Jordan) when trying to commit each atomic commit on a branch to reviewboard in git-svn land.

applied over a8f4db54db3fe1058423c7280c5b825016edeeff (after tag release-0.5)

Thanks!
david
#8 david
Fixed in rbtools master (dc0b739). Thanks!
  • -New
    +Fixed