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

Unified Diff: tools/push-to-trunk/common_includes.py

Issue 604853002: Add new git port to merge_to_branch script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/common_includes.py
diff --git a/tools/push-to-trunk/common_includes.py b/tools/push-to-trunk/common_includes.py
index c1c2aa56ff0204de35498f52bd6b8a9e35be48f9..312bc24ad5c0baf9004ebee6e0bdd0572d8c11f4 100644
--- a/tools/push-to-trunk/common_includes.py
+++ b/tools/push-to-trunk/common_includes.py
@@ -346,6 +346,43 @@ class GitSvnInterface(VCInterface):
self.step.GitSVNTag(tag)
+class GitReadOnlyMixin(VCInterface):
+ def Pull(self):
+ self.step.GitPull()
+
+ def Fetch(self):
+ self.step.Git("fetch")
+
+ def GetTags(self):
+ return self.step.Git("tag").strip().splitlines()
+
+ def GetBranches(self):
+ # Get relevant remote branches, e.g. "origin/branch-heads/3.25".
+ branches = filter(
+ lambda s: re.match(r"^origin/branch\-heads/\d+\.\d+$", s),
+ self.step.GitRemotes())
+ # Remove 'origin/branch-heads/' prefix.
+ return map(lambda s: s[20:], branches)
+
+ def RemoteMasterBranch(self):
+ return "origin/master"
+
+ def RemoteCandidateBranch(self):
+ return "origin/candidates"
+
+ def RemoteBranch(self, name):
+ return "origin/branch-heads/%s" % name
+
+
+class GitReadSvnWriteInterface(GitReadOnlyMixin, GitSvnInterface):
+ pass
+
+
+VC_INTERFACES = {
+ "git_svn": GitSvnInterface,
+ "git_read_svn_write": GitReadSvnWriteInterface,
+}
+
class Step(GitRecipesMixin):
def __init__(self, text, number, config, state, options, handler):
@@ -355,7 +392,7 @@ class Step(GitRecipesMixin):
self._state = state
self._options = options
self._side_effect_handler = handler
- self.vc = GitSvnInterface()
+ self.vc = VC_INTERFACES[options.vc_interface]()
self.vc.InjectStep(self)
# The testing configuration might set a different default cwd.
@@ -740,6 +777,9 @@ class ScriptsBase(object):
parser.add_argument("-s", "--step",
help="Specify the step where to start work. Default: 0.",
default=0, type=int)
+ parser.add_argument("--vc-interface",
+ help=("Choose VC interface out of git_svn|"
+ "git_read_svn_write."))
self._PrepareOptions(parser)
if args is None: # pragma: no cover
@@ -776,6 +816,9 @@ class ScriptsBase(object):
if not self._ProcessOptions(options):
parser.print_help()
return None
+
+ if not options.vc_interface:
+ options.vc_interface = "git_svn"
return options
def RunSteps(self, step_classes, args=None):
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698