Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: tools/push-to-trunk/git_recipes.py

Issue 181603002: Fix patch creation in merge-to-branch script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/push-to-trunk/merge_to_branch.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 the V8 project authors. All rights reserved. 2 # Copyright 2014 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 @Strip 66 @Strip
67 def GitCurrentBranch(self): 67 def GitCurrentBranch(self):
68 for line in self.Git("status -s -b -uno").strip().splitlines(): 68 for line in self.Git("status -s -b -uno").strip().splitlines():
69 match = re.match(r"^## (.+)", line) 69 match = re.match(r"^## (.+)", line)
70 if match: return match.group(1) 70 if match: return match.group(1)
71 raise Exception("Couldn't find curent branch.") 71 raise Exception("Couldn't find curent branch.")
72 72
73 @Strip 73 @Strip
74 def GitLog(self, n=0, format="", grep="", git_hash="", parent_hash="", 74 def GitLog(self, n=0, format="", grep="", git_hash="", parent_hash="",
75 branch="", reverse=False, patch=False): 75 branch="", reverse=False):
76 assert not (git_hash and parent_hash) 76 assert not (git_hash and parent_hash)
77 args = ["log"] 77 args = ["log"]
78 if n > 0: 78 if n > 0:
79 args.append("-%d" % n) 79 args.append("-%d" % n)
80 if format: 80 if format:
81 args.append("--format=%s" % format) 81 args.append("--format=%s" % format)
82 if grep: 82 if grep:
83 args.append("--grep=\"%s\"" % grep) 83 args.append("--grep=\"%s\"" % grep)
84 if reverse: 84 if reverse:
85 args.append("--reverse") 85 args.append("--reverse")
86 if patch:
87 args.append("-p")
88 if git_hash: 86 if git_hash:
89 args.append(git_hash) 87 args.append(git_hash)
90 if parent_hash: 88 if parent_hash:
91 args.append("%s^" % parent_hash) 89 args.append("%s^" % parent_hash)
92 args.append(branch) 90 args.append(branch)
93 return self.Git(MakeArgs(args)) 91 return self.Git(MakeArgs(args))
94 92
93 def GitGetPatch(self, git_hash):
94 assert git_hash
95 return self.Git(MakeArgs(["log", "-1", "-p", git_hash]))
96
95 def GitAdd(self, name): 97 def GitAdd(self, name):
96 assert name 98 assert name
97 self.Git(MakeArgs(["add", Quoted(name)])) 99 self.Git(MakeArgs(["add", Quoted(name)]))
98 100
99 def GitApplyPatch(self, patch_file, reverse=False): 101 def GitApplyPatch(self, patch_file, reverse=False):
100 assert patch_file 102 assert patch_file
101 args = ["apply --index --reject"] 103 args = ["apply --index --reject"]
102 if reverse: 104 if reverse:
103 args.append("--reverse") 105 args.append("--reverse")
104 args.append(Quoted(patch_file)) 106 args.append(Quoted(patch_file))
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 @Strip 154 @Strip
153 def GitSVNFindSVNRev(self, git_hash, branch=""): 155 def GitSVNFindSVNRev(self, git_hash, branch=""):
154 return self.Git(MakeArgs(["svn find-rev", git_hash, branch])) 156 return self.Git(MakeArgs(["svn find-rev", git_hash, branch]))
155 157
156 def GitSVNDCommit(self): 158 def GitSVNDCommit(self):
157 return self.Git("svn dcommit 2>&1", retry_on=lambda x: x is None) 159 return self.Git("svn dcommit 2>&1", retry_on=lambda x: x is None)
158 160
159 def GitSVNTag(self, version): 161 def GitSVNTag(self, version):
160 self.Git(("svn tag %s -m \"Tagging version %s\"" % (version, version)), 162 self.Git(("svn tag %s -m \"Tagging version %s\"" % (version, version)),
161 retry_on=lambda x: x is None) 163 retry_on=lambda x: x is None)
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/merge_to_branch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698