Updated SVNTool.parse_diff_revision to handle possible whitespace in front of revision argument
Updated 6 months ago
| Mat Schaffer | Reviewers | ||
| trunk | reviewboard | ||
| None | Review Board SVN | ||
The regular expression in SVNTool didn't like revision lines that had only whitespace between the file and revision arguments. Like this one that came from svnlook on a revision that contained a new file: Added: trunk/thingie/more =================================================================== --- trunk/thingie/more (rev 0) +++ trunk/thingie/more 2008-07-07 22:36:27 UTC (rev 4)
Unit tests updated. ./manage.py test scmtools passed.
Diff revision 1 (Latest)
- /trunk/reviewboard/scmtools/svn.py: 3 changes [ 1 2 3 ]
- /trunk/reviewboard/scmtools/tests.py: 1 change [ 1 ]
| /trunk/reviewboard/scmtools/svn.py | |||
|---|---|---|---|
| Revision 1390 | New Change | ||
| ... | 51 lines hidden [Expand] | ||
| 52 | 52 | ||
| 53 | self.uses_atomic_revisions = True |
53 | self.uses_atomic_revisions = True |
| 54 | 54 | ||
| 55 | # svnlook uses 'rev 0', while svn diff uses 'revision 0' |
55 | # svnlook uses 'rev 0', while svn diff uses 'revision 0' |
| 56 | self.revision_re = re.compile(""" |
56 | self.revision_re = re.compile(""" |
| 57 | ^(\(([^\)]+)\)\s)? # creating diffs between two branches |
57 | ^(\(([^\)]+)\)\s)? # creating diffs between two branches |
| 58 | # of a remote repository will insert |
58 | # of a remote repository will insert |
| 59 | # extra "relocation information" into |
59 | # extra "relocation information" into |
| 60 | # the diff. |
60 | # the diff. |
| 61 | 61 | ||
| 62 | (?:\d+-\d+-\d+\ + # svnlook-style diffs contain a |
62 | (?:\d+-\d+-\d+\ + # svnlook-style diffs contain a |
| 63 | \d+:\d+:\d+\ + # timestamp on each line before the |
63 | \d+:\d+:\d+\ + # timestamp on each line before the |
| 64 | [A-Z]+\ +)? # revision number. This here is |
64 | [A-Z]+\ +)? # revision number. This here is |
| 65 | # probably a really crappy way to |
65 | # probably a really crappy way to |
| 66 | # express that, but oh well. |
66 | # express that, but oh well. |
| 67 | 67 | ||
| 68 | \([Rr]ev(?:ision)?\ (\d+)\)$ # svnlook uses 'rev 0' while svn diff |
68 | \ *\([Rr]ev(?:ision)?\ (\d+)\)$ # svnlook uses 'rev 0' while svn diff |
| 69 | # uses 'revision 0' |
69 | # uses 'revision 0' |
| 70 | """, re.VERBOSE) |
70 | """, re.VERBOSE) |
| 71 | 71 | ||
| 72 | 72 | ||
| 73 | def get_file(self, path, revision=HEAD): |
73 | def get_file(self, path, revision=HEAD): |
| ... | 172 lines hidden [Expand] | ||
| /trunk/reviewboard/scmtools/tests.py | |||
|---|---|---|---|
| Revision 1390 | New Change | ||
| ... | 231 lines hidden [Expand] | ||
| 232 | 232 | ||
| 233 | def testRevisionParsing(self): |
233 | def testRevisionParsing(self): |
| 234 | """Testing revision number parsing""" |
234 | """Testing revision number parsing""" |
| 235 | self.assertEqual(self.tool.parse_diff_revision('', '(working copy)')[1], |
235 | self.assertEqual(self.tool.parse_diff_revision('', '(working copy)')[1], |
| 236 | HEAD) |
236 | HEAD) |
| 237 | self.assertEqual(self.tool.parse_diff_revision('', '(revision 0)')[1], |
237 | self.assertEqual(self.tool.parse_diff_revision('', ' (revision 0)')[1], |
| 238 | PRE_CREATION) |
238 | PRE_CREATION) |
| 239 | 239 | ||
| 240 | self.assertEqual(self.tool.parse_diff_revision('', '(revision 1)')[1], |
240 | self.assertEqual(self.tool.parse_diff_revision('', '(revision 1)')[1], |
| 241 | '1') |
241 | '1') |
| 242 | self.assertEqual(self.tool.parse_diff_revision('', '(revision 23)')[1], |
242 | self.assertEqual(self.tool.parse_diff_revision('', '(revision 23)')[1], |
| ... | 611 lines hidden [Expand] | ||
- /trunk/reviewboard/scmtools/svn.py: 3 changes [ 1 2 3 ]
- /trunk/reviewboard/scmtools/tests.py: 1 change [ 1 ]
Other reviews