Retry fetching a file using the base commit id if fetching it using the original rev fails

Review Request #5965 — Created June 10, 2014 and submitted

Information

Review Board
release-2.0.x

Reviewers

When developing with Mercurial, a common workflow is to be working on a series of patches at any one time, and push/pop them as required. So, "hg log" might list something like:

5 qtip [mq] patch3
4 [mq] patch2
3 [mq] patch1
2 qparent second checkin
1 first checkin

When creating a review request, 'rbt post qtip' creates two diffs: from 2-4 (the parent diff) and 4-5 (diff in review). The problem occurs when a file is changed in patch3 that's not in any of the previous patches. In this case, the diff in review is relative to changeset 4, but "hg cat -r 4 path/to/a/file" fails because the file isn't in the parent diff.

Work around this problem by trying to get a file from the base commit id if fetching it via the revision recorded in the diff fails.

Pushed 4 patches and ran 'rbt post qtip'; verified that the diff viewer showed all of the changes.

reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/scmtools/models.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/scmtools/models.py
      Ignored Files:
    
    
  2. 
      
david
  1. I'm going to make some small changes (adding a comment and checking that base_commit_id is valid) and push this. Thanks!

  2. 
      
BC
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (0971b25)