Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 3312 by [email protected]: Diffs without embedded commit IDs can not be used
http://code.google.com/p/reviewboard/issues/detail?id=3312

*** READ THIS BEFORE POSTING!
***
*** You must complete this form in its entirety, or your bug report will be
rejected.
***
*** For customer support, please post to [email protected]
***
*** If you have a patch, please submit it to
http://reviews.reviewboard.org/
***
*** Do not post confidential information in this bug report!


What version are you running?
2.0 RC2

What's the URL of the page containing the problem?
/r/1/diff/


What steps will reproduce the problem?
1. Create a new Mercurial repository in RB using the following path:
https://bitbucket.org/laggyluke/rb-bug

2. Create new review request:

        $ curl -i http://admin:[email protected]/api/review-requests/ \
            -d repository=1

        HTTP/1.1 201 CREATED
        Date: Fri, 18 Apr 2014 12:12:42 GMT
        Server: Apache/2.2.22 (Ubuntu)
        Content-Length: 1798
        Content-Language: en
        X-Content-Type-Options: nosniff
        Expires: Fri, 18 Apr 2014 12:12:42 GMT
        Vary: Accept,Cookie,Accept-Language,Accept-Encoding
        Last-Modified: Fri, 18 Apr 2014 12:12:42 GMT
        Cache-Control: max-age=0
        X-Frame-Options: SAMEORIGIN
Set-Cookie: rbsessionid=vdjff0woxz2rilan3jzb0syv44lkimxu; expires=Sat, 18-Apr-2015 12:12:42 GMT; httponly; Max-Age=31536000; Path=/
        Content-Type: application/vnd.reviewboard.org.review-request+json

{"stat": "ok", "review_request": {"status": "pending", "last_updated": "2014-04-18T12:12:42Z", "links": {"diffs": {"href": "http://rb.dev/api/review-requests/1/diffs/";, "method": "GET"}, "repository": {"href": "http://rb.dev/api/repositories/1/";, "method": "GET", "title": "rb-bug"}, "screenshots": {"href": "http://rb.dev/api/review-requests/1/screenshots/";, "method": "GET"}, "self": {"href": "http://rb.dev/api/review-requests/1/";, "method": "GET"}, "update": {"href": "http://rb.dev/api/review-requests/1/";, "method": "PUT"}, "last_update": {"href": "http://rb.dev/api/review-requests/1/last-update/";, "method": "GET"}, "reviews": {"href": "http://rb.dev/api/review-requests/1/reviews/";, "method": "GET"}, "file_attachments": {"href": "http://rb.dev/api/review-requests/1/file-attachments/";, "method": "GET"}, "draft": {"href": "http://rb.dev/api/review-requests/1/draft/";, "method": "GET"}, "diff_context": {"href": "http://rb.dev/api/review-requests/1/diff-context/";, "method": "GET"}, "submitter": {"href": "http://rb.dev/api/users/admin/";, "method": "GET", "title": "admin"}, "changes": {"href": "http://rb.dev/api/review-requests/1/changes/";, "method": "GET"}, "delete": {"href": "http://rb.dev/api/review-requests/1/";, "method": "DELETE"}}, "depends_on": [], "issue_resolved_count": 0, "ship_it_count": 0, "id": 1, "target_people": [], "changenum": null, "bugs_closed": [], "testing_done": "", "branch": "", "time_added": "2014-04-18T12:12:42Z", "extra_data": {}, "public": false, "commit_id": null, "blocks": [], "description": "", "text_type": "plain", "issue_open_count": 0, "approved": false, "url": "/r/1/", "absolute_url": "http://rb.dev/r/1/";, "target_groups": [], "summary": "", "issue_dropped_count": 0, "approval_failure": "The review request has not been marked \"Ship It!\""}}

3. Observe following diff:

        $ cat test.patch
        diff --git a/README.md b/README.md
        --- a/README.md
        +++ b/README.md
        @@ -1,3 +1,5 @@
         Commits:

         * First commit
        +* Second commit
        +* Third commit

4. As the above diff doesn't have any commit IDs, explicitly specify
    `base_commit_id` during upload:

$ curl -i http://admin:[email protected]/api/review-requests/1/draft/diffs/ \
            -F base_commit_id=4c43907 \
            -F [email protected]

        HTTP/1.1 100 Continue

        HTTP/1.1 201 CREATED
        Date: Fri, 18 Apr 2014 12:17:53 GMT
        Server: Apache/2.2.22 (Ubuntu)
        Content-Length: 559
        Content-Language: en
        X-Content-Type-Options: nosniff
        Expires: Fri, 18 Apr 2014 12:17:53 GMT
        Vary: Accept,Cookie,Accept-Language,Accept-Encoding
        Last-Modified: Fri, 18 Apr 2014 12:17:53 GMT
        Cache-Control: max-age=0
        X-Frame-Options: SAMEORIGIN
Set-Cookie: rbsessionid=ebozaewk9kmyzv4go6emonz6139ppmrl; expires=Sat, 18-Apr-2015 12:17:53 GMT; httponly; Max-Age=31536000; Path=/
        Content-Type: text/plain

{"diff": {"name": "test.patch", "links": {"self": {"href": "http://rb.dev/api/review-requests/1/draft/diffs/1/";, "method": "GET"}, "draft_files": {"href": "http://rb.dev/api/review-requests/1/draft/diffs/1/files/";, "method": "GET"}, "update": {"href": "http://rb.dev/api/review-requests/1/draft/diffs/1/";, "method": "PUT"}, "repository": {"href": "http://rb.dev/api/repositories/1/";, "method": "GET", "title": "rb-bug"}}, "timestamp": "2014-04-18T12:17:36Z", "basedir": "", "extra_data": {}, "revision": 1, "id": 1, "base_commit_id": "4c43907"}, "stat": "ok"}

5. Open the diff in a web interface.

What is the expected output? What do you see instead?
I expect to see the diff.
Instead, I see this:
http://i.imgur.com/cUQGJ4o.png

What operating system are you using? What browser?
N/A

Please provide any additional information below.
This may be specific to Mercurial repositories, but I'm not sure.
The following patch seems to fix this, but it may have some other undesired side effects that I haven't considered:
https://gist.github.com/laggyluke/a7f9b082ad7db95ab564


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/d/optout.

Reply via email to