My favorites | Sign in
Project Home Wiki Issues
New issue   Search
for
  Advanced search   Search tips
Issue 883: GitDiffParser parses file additions badly (fix patch enclosed in description)
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  chip...@gmail.com
Closed:  Mar 2009


Sign in to add a comment
 
Reported by anfedorov, Feb 11, 2009
What's the URL of the page containing the problem?

http://localhost:8000/r/11/diff/#index_header

What steps will reproduce the problem?
1. Submit patch with new added files using post-review.py
2. Go to diff page
3. Notice that first two letters of the file name are cut off

What is the expected output? What do you see instead?

Expected:

-- quote --
Files Changed:

   1. test.post: 1 change [ new content ]
-- endquote --

Saw:

-- quote --
Files Changed:
   1. st.post: 1 change [ new content ]
-- endquote --

What operating system are you using? What browser?

Ubuntu 8.10
Firefox 3.0.5
Python 2.5.2 on server

Please provide any additional information below.

This patch fixes things:

Index: scmtools/git.py                                                
===================================================================   
--- scmtools/git.py     (revision 1768)                               
+++ scmtools/git.py     (working copy)                                
@@ -105,8 +105,9 @@                                                   
             diffLine = self.lines[i].split()                         
             try:                                                     
                 # Need to remove the "a/" and "b/" prefix
-                file.origFile = diffLine[-2][2:]
-                file.newFile = diffLine[-1][2:]
+                remPrefix = re.compile("^[a|b]/");
+                file.origFile = remPrefix.sub("", diffLine[-2])
+                file.newFile = remPrefix.sub("", diffLine[-1])
             except ValueError:
                 raise DiffParserError(
                     "The diff file is missing revision information",
Comment 1 by project member trowb...@gmail.com, Feb 11, 2009
Can you post this on http://reviews.review-board.org/ ? Thanks.
Labels: -Type-Defect Type-Patch Component-SCMTools
Comment 2 by anfedorov, Feb 12, 2009
Done: http://reviews.review-board.org/r/745/
Comment 3 by project member chip...@gmail.com, Mar 12, 2009
Fixed in r1814.
Status: Fixed
Owner: chipx86
Labels: Milestone-Release1.0
Sign in to add a comment

Powered by Google Project Hosting