Thanks much Chris.
I understand your point, but when I execute git diff origin/foo..HEAD, it
would give me diff between HEAD of origin/foo and HEAD of my working copy.
However, on Reviewboard, the branch of repo that is connected is
origin/master. Hence, Reviewboard, will not be able to patch and display
this diff.

I'm posting detailed info about what I'm trying to do -

I have 2 branches -

root@localhost:~/temp/REPO$ git branch -a
* dev
  master
  remotes/origin/dev

Now, I did - "git checkout -b dev remotes/origin/dev" followed by -

root@localhost:~/temp/REPO$ git branch
* dev
  master

Now I edited one of the files in 'dev' branch which is not present in
'master' branch yet and committed the changes to local repo.

root@localhost:~/temp/REPO$ git status
# On branch dev
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working
directory)
#
# modified:   src/com/SampleFile.java
#
no changes added to commit (use "git add" and/or "git commit -a")

root@localhost:~/temp/REPO$ git commit -a -m "Test comment"

And then I created a Review Request using post-review.
root@localhost:~/temp/REPO$ post-review
--tracking-branch=remotes/origin/dev
--server=http://localhost/--repository-url=test
Review request #6 posted.

http://localhost/r/6/

Now when I check the above url, and click on view diff, it shows me an
error -

Content-Type: text/html; charset=utf-8src/com/SampleFile.javaRevision
3ae40c7b34cbc739ef6416abdee963de2d7369e5New ChangeDiff currently
unavailable.*Error:* The patch to 'src/com/SampleFile.java' didn't apply
cleanly. The temporary files have been left in '/tmp/reviewboard.Fx_0AX'
for debugging purposes. `patch` returned: patching file
/tmp/reviewboard.Fx_0AX/tmpyk9Lab Hunk #1 FAILED at 61. 1 out of 1 hunk
FAILED -- saving rejects to file /tmp/reviewboard.Fx_0AX/tmpyk9Lab-new.rej
Details <http://mcse-qa/mcse/r/6/diff/#>

Traceback (most recent call last):
  File 
"/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.5-py2.7.egg/reviewboard/diffviewer/views.py",
line 383, in view_diff_fragment
    file = get_requested_diff_file()
  File 
"/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.5-py2.7.egg/reviewboard/diffviewer/views.py",
line 309, in get_requested_diff_file
    populate_diff_chunks(files, highlighting)
  File 
"/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.5-py2.7.egg/reviewboard/diffviewer/diffutils.py",
line 1197, in populate_diff_chunks
    large_data=True)
  File 
"/usr/local/lib/python2.7/dist-packages/Djblets-0.7.10-py2.7.egg/djblets/util/misc.py",
line 156, in cache_memoize
    data = lookup_callable()
  File 
"/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.5-py2.7.egg/reviewboard/diffviewer/diffutils.py",
line 1196, in <lambda>
    enable_syntax_highlighting)),
  File 
"/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.5-py2.7.egg/reviewboard/diffviewer/diffutils.py",
line 599, in get_chunks
    new = get_patched_file(old, filediff)
  File 
"/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.5-py2.7.egg/reviewboard/diffviewer/diffutils.py",
line 392, in get_patched_file
    return patch(diff, buffer, filediff.dest_file)
  File 
"/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.5-py2.7.egg/reviewboard/diffviewer/diffutils.py",
line 251, in patch
    (filename, tempdir, patch_output))
Exception: The patch to 'src/com/SampleFile.java' didn't apply
cleanly. The temporary files have been left in
'/tmp/reviewboard.Fx_0AX' for debugging purposes.
`patch` returned: patching file /tmp/reviewboard.Fx_0AX/tmpyk9Lab
Hunk #1 FAILED at 61.
1 out of 1 hunk FAILED -- saving rejects to file
/tmp/reviewboard.Fx_0AX/tmpyk9Lab-new.rej

I also tried using --parent option which also gave me similar error.
Could you please help me with this.

-Karan


On Sun, Feb 17, 2013 at 8:51 AM, Christian Hammond <chip...@chipx86.com>wrote:

> Hi Karan,
>
> Unfortunately, it doesn't work like that. The diff has to be generated
> client-side with knowledge of the tracking branch. We don't take
> information like the tracking branch server-side and use it to figure out
> how to apply/verify the diff. Rather, that information must be part of the
> diff computation.
>
> Let's go through some examples.
>
> When you do:
>
>     $ post-review --tracking-branch=origin/foo
>
> What you are really doing is:
>
>     $ git diff origin/foo..HEAD
>
> You're generating a diff with all changes between the tracking branch and
> the top-most commit. At no point does the server know about any details of
> those branches, because it wouldn't matter. All it knows is the files
> changed, the source revisions (which are computed when doing a `git diff`
> like above), and the changes made between those revisions.
>
> So it sounds like you need to make sure any diff you generate through egit
> is between a range of <some pushed branch>..HEAD.
>
> One more thing that's important is that the resulting diffs *must* display
> full SHA1s. `git diff` doesn't do this by default. Instead, it shows
> shortened (usually 7 character) SHA1s. This is typically solved by passing
> --full-index to `git diff`. I don't know egit at all, so I can't say if
> there are equivalent options.
>
> Christian
>
> --
> Christian Hammond - chip...@chipx86.com
> Review Board - http://www.reviewboard.org
> VMware, Inc. - http://www.vmware.com
>
> On Feb 16, 2013, at 7:13 PM, Karan Jain <karanjain.it...@gmail.com> wrote:
>
> Not sure if I understood it correctly.
>
> I'm using egit plugin with eclipse and I have cloned the particular branch
> 'dev' into my working copy. Now, after making changes I create a diff.
> Hence, while creating diff I have ensured that the branch was 'dev'. Now
> when I try to upload it through the UI, it gives an error saying the file
> not present (probably because it is trying to get the HEAD of master and
> applying a diff of dev branch to generate new revision)
>
> Hence, should there not be any setting while uploading a diff as to
> mentioned the target-branch of the repo it should try to apply the patch to?
>
> -Karan
>
>
> On Sun, Feb 17, 2013 at 8:29 AM, Christian Hammond <chip...@chipx86.com>wrote:
>
>> There is no such way. It must be done at diff generation time, because we
>> need an accurate diff of exactly what you want to display, and that cannot
>> be computed on the server.
>>
>> This is especially true for Git, because Git's protocol does not allow us
>> to do anything complex (like generate a diff) with a remote repository
>> without having a full, up-to-date clone of it, which Review Board does not
>> do (there are many very good reasons for this).
>>
>> Christian
>>
>> --
>> Christian Hammond - chip...@chipx86.com
>>
>> Review Board - http://www.reviewboard.org
>> VMware, Inc. - http://www.vmware.com
>>
>> On Feb 16, 2013, at 6:51 PM, Karan Jain <karanjain.it...@gmail.com>
>> wrote:
>>
>> Thanks Chris. You are correct, I would be able to achieve what I want to
>> with either --parent or --tracking-branch option.
>>
>> What I'm looking for is how to specify these options via UI and not using
>> post-review. The reason is this -
>> I have deployed the RB portal on a server and many people would be
>> accessing it via browser. Hence, asking everyone to install post-review
>> tool would actually not be a good option. So, looking for a way to do it
>> through Admin UI for each repository.
>>
>> -Karan
>>
>> On Sunday, February 17, 2013 3:18:13 AM UTC+5:30, Christian Hammond wrote:
>>>
>>> Hi,
>>>
>>> Is the dev branch pushed upstream, or is it local to your repository?
>>>
>>> When working with Git, there are three branches to keep in mind:
>>>
>>> 1) The branch containing your change.
>>> 2) The parent branch, if any, that your branch derives from.
>>> 3) The tracking branch (origin/master, origin/dev, whatever is upstream
>>> that your branch is eventually derived from).
>>>
>>> The tracking branch defaults to origin/master. By default, any diff
>>> generated will be between the tracking branch and HEAD.
>>>
>>> If you have a different tracking branch (let's say origin/release), then
>>> you can pass --tracking-branch=<branchname> to it.
>>>
>>> If you have a branch based on another (unpushed) branch, you'd want to
>>> specify that branch as your branch's parent, using --parent=<branchname>
>>>
>>> In a simple setup, you'd have a branch off of origin/master, and all you
>>> would need to do is run "post-review" on it.
>>>
>>> In a more complex case where your branch looks like:
>>>
>>> origin/dev
>>> |
>>> |- my-parent
>>>     |
>>>     |- my-branch
>>>
>>> You would checkout my-branch and do:
>>>
>>>     post-review --tracking-branch=origin/dev --parent=my-parent
>>>
>>> You can add the default for the tracking branch to your .reviewboardrc:
>>>
>>>     TRACKING_BRANCH = 'origin/dev'
>>>
>>> Hope that gives you a good overview of how you might handle this.
>>> Without knowing your branching setup better, it's hard for me to give a
>>> more specific example.
>>>
>>> Christian
>>>
>>> --
>>> Christian Hammond - chi...@chipx86.com
>>> Review Board - http://www.reviewboard.org
>>> VMware, Inc. - http://www.vmware.com
>>>
>>>
>>> On Sat, Feb 16, 2013 at 8:19 AM, Karan Jain <karanja...@gmail.com>wrote:
>>>
>>>> Hello,
>>>>
>>>> We are using Github Enterprise version for our organization. I was
>>>> trying to add a repository and was able to do so successfully. I chose -
>>>>
>>>> Hosting service - None (Custom Repository)
>>>> Repository type - Git
>>>>
>>>> Now my working branch name is dev and not master. I wish to upload a
>>>> review request on the dev branch. How can I do that?
>>>>
>>>> If I try to upload it says that the file is not present in the repo
>>>> which means it is trying to look up in master branch where the file has not
>>>> yet been checked in. However, the file is present in the 'dev' branch and
>>>> the review request needs to be created on this branch.
>>>>
>>>> --
>>>> Karan Jain
>>>>
>>>> --
>>>> Want to help the Review Board project? Donate today at
>>>> http://www.reviewboard.org/**donate/<http://www.reviewboard.org/donate/>
>>>> Happy user? Let us know at 
>>>> http://www.reviewboard.org/**users/<http://www.reviewboard.org/users/>
>>>> -~----------~----~----~----~--**----~----~------~--~---
>>>> To unsubscribe from this group, send email to reviewboard...@**
>>>> googlegroups.com
>>>> For more options, visit this group at http://groups.google.com/**
>>>> group/reviewboard?hl=en<http://groups.google.com/group/reviewboard?hl=en>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "reviewboard" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to reviewboard...@**googlegroups.com.
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>
>>>>
>>>>
>>>
>>>
>> --
>> Want to help the Review Board project? Donate today at
>> http://www.reviewboard.org/donate/
>> Happy user? Let us know at http://www.reviewboard.org/users/
>> -~----------~----~----~----~------~----~------~--~---
>> To unsubscribe from this group, send email to
>> reviewboard+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/reviewboard?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "reviewboard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to reviewboard+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>>
>>
>> --
>> Want to help the Review Board project? Donate today at
>> http://www.reviewboard.org/donate/
>> Happy user? Let us know at http://www.reviewboard.org/users/
>> -~----------~----~----~----~------~----~------~--~---
>> To unsubscribe from this group, send email to
>> reviewboard+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/reviewboard?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "reviewboard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to reviewboard+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Karan Jain
>
> --
> Want to help the Review Board project? Donate today at
> http://www.reviewboard.org/donate/
> Happy user? Let us know at http://www.reviewboard.org/users/
> -~----------~----~----~----~------~----~------~--~---
> To unsubscribe from this group, send email to
> reviewboard+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/reviewboard?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "reviewboard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> Want to help the Review Board project? Donate today at
> http://www.reviewboard.org/donate/
> Happy user? Let us know at http://www.reviewboard.org/users/
> -~----------~----~----~----~------~----~------~--~---
> To unsubscribe from this group, send email to
> reviewboard+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/reviewboard?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "reviewboard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Karan Jain

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to