RESOLVED FIXED 55024
fix svn revision number finding when creating git patches
https://bugs.webkit.org/show_bug.cgi?id=55024
Summary fix svn revision number finding when creating git patches
Ojan Vafai
Reported 2011-02-22 23:34:35 PST
fix revision number finding when creating git patches
Attachments
Patch (3.08 KB, patch)
2011-02-22 23:36 PST, Ojan Vafai
tony: review+
Ojan Vafai
Comment 1 2011-02-22 23:36:49 PST
Adam Barth
Comment 2 2011-02-23 01:19:58 PST
Obligatory deferring to evmar. :)
Adam Roben (:aroben)
Comment 3 2011-02-23 08:07:09 PST
Comment on attachment 83452 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=83452&action=review > Tools/Scripts/webkitpy/common/checkout/scm.py:752 > + git_log = self.run(['git', 'log', '-10']) > + match = re.search("^\s*git-svn-id:.*@(?P<svn_revision>\d+)\ .*$", git_log, re.MULTILINE) > + if not match: I think you can just use "git svn info". It seems to work at least in simple cases. I haven't tried it with a merge commit, though.
Evan Martin
Comment 4 2011-02-23 09:41:24 PST
Here's how this is done within git-svn (as translated into my python). git-svn doesn't have the -100 limit. http://neugierig.org/software/git/?url=git-cl/tree/git-cl#n143 142 # The -100 is an arbitrary limit so we don't search forever. 143 cmd = ['git', 'log', '-100', '--pretty=medium'] 144 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) 145 for line in proc.stdout: 146 match = git_svn_re.match(line) 147 if match: 148 url = match.group(1) 151 proc.stdout.close() # Cut pipe. 152 break I think Ojan's is probably fine too though. "git svn info" will fail if you have a git checkout that isn't a git-svn checkout. Not sure if that applies here.
Tony Chang
Comment 5 2011-02-23 10:37:44 PST
Comment on attachment 83452 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=83452&action=review This or evan's version looks fine. > Tools/Scripts/webkitpy/common/checkout/scm.py:751 > + match = re.search("^\s*git-svn-id:.*@(?P<svn_revision>\d+)\ .*$", git_log, re.MULTILINE) Nit: I'm not sure the .*$ gives you anything (aren't you always going to have something before the end of the line?)
Ojan Vafai
Comment 6 2011-02-23 22:27:25 PST
(In reply to comment #4) > 142 # The -100 is an arbitrary limit so we don't search forever. > 143 cmd = ['git', 'log', '-100', '--pretty=medium'] I wasn't sure what limit to set. 10 is probably too small. I'll make it 25 for now. > "git svn info" will fail if you have a git checkout that isn't a git-svn checkout. Right.
Ojan Vafai
Comment 7 2011-02-24 00:14:13 PST
Note You need to log in before you can comment on or make changes to this bug.