--- a/autoland/autoland/transplant.py
+++ b/autoland/autoland/transplant.py
@@ -56,31 +56,53 @@ class Transplant:
def __init__(self, hg_repo, tree, destination, rev):
self.hg_repo = hg_repo
self.tree = tree
self.destination = destination
self.source_rev = rev
def push_try(self, trysyntax):
self.update_repo()
- rev = self.push_to_try(trysyntax)
+
+ if not trysyntax.startswith("try: "):
+ trysyntax = "try: %s" % trysyntax
+ rev = self.run_hg_cmds([
+ [
+ '--encoding=utf-8',
+ '--config', 'ui.allowemptycommit=true',
+ 'commit',
+ '-m', trysyntax
+ ],
+ ['push', '-r', '.', '-f', 'try'],
+ ['log', '-r', 'tip', '-T', '{node|short}'],
+ ])
+
self.strip_drafts()
return rev
def push_bookmark(self, commit_descriptions, bookmark):
remote_tip = self.update_repo()
+
rev = self.apply_changes(remote_tip, commit_descriptions)
- self.push_bookmark_to_repo(bookmark)
+ self.run_hg_cmds([
+ ['bookmark', bookmark],
+ ['push', '-B', bookmark, self.destination],
+ ])
+
self.strip_drafts()
return rev
def push(self, commit_descriptions):
remote_tip = self.update_repo()
+
rev = self.apply_changes(remote_tip, commit_descriptions)
- self.push_to_repo()
+ self.run_hg_cmds([
+ ['push', '-r', 'tip', self.destination]
+ ])
+
self.strip_drafts()
return rev
def update_repo(self):
# Obtain remote tip. We assume there is only a single head.
remote_tip = self.get_remote_tip()
# Strip any lingering draft changesets.
@@ -213,34 +235,8 @@ class Transplant:
logger.error('unexpected outgoing commits:')
for commit in outgoing:
logger.error('outgoing: %s: %s' % (commit[1], commit[5]))
raise Exception("We're sorry - something has gone wrong while "
"rewriting or rebasing your commits. The commits "
"being pushed no longer match what was requested. "
"Please file a bug.")
-
- def push_to_try(self, trysyntax):
- if not trysyntax.startswith("try: "):
- trysyntax = "try: %s" % trysyntax
- return self.run_hg_cmds([
- [
- '--encoding=utf-8',
- '--config', 'ui.allowemptycommit=true',
- 'commit',
- '-m', trysyntax
- ],
- ['push', '-r', '.', '-f', 'try'],
- ['log', '-r', 'tip', '-T', '{node|short}'],
- ])
-
- def push_bookmark_to_repo(self, bookmark):
- self.run_hg_cmds([
- ['bookmark', bookmark],
- ['push', '-B', bookmark, self.destination],
- ])
-
- def push_to_repo(self):
- self.run_hg_cmds([
- ['push', '-r', 'tip', self.destination]
- ])
-