Merge "Fixes to get cros_mark_as_stable to work with Gerrit changes." into 0.11.257.B
diff --git a/buildbot/cros_mark_as_stable.py b/buildbot/cros_mark_as_stable.py
index a6b262c..7d4e871 100755
--- a/buildbot/cros_mark_as_stable.py
+++ b/buildbot/cros_mark_as_stable.py
@@ -55,7 +55,8 @@
 
 def _Print(message):
   """Verbose print function."""
-  if VERBOSE: Info(message)
+  if VERBOSE:
+    Info(message)
 
 
 def _CleanStalePackages(board, package_atoms):
@@ -356,6 +357,7 @@
       dir = 'platform'
     else:
       dir = 'third_party'
+
     srcdir = os.path.join(srcroot, dir, subdir)
 
     if not os.path.isdir(srcdir):
@@ -516,7 +518,7 @@
   parser.add_option('-r', '--srcroot',
                     default='%s/trunk/src' % os.environ['HOME'],
                     help='Path to root src directory.')
-  parser.add_option('-t', '--tracking_branch', default='cros/master',
+  parser.add_option('-t', '--tracking_branch', default='master',
                      help='Used with commit to specify branch to track.')
   parser.add_option('--verbose', action='store_true',
                     help='Prints out debug info.')
@@ -559,13 +561,14 @@
     # the cwd being set to the overlay directory. We should instead pass in
     # this parameter so that we don't need to modify the cwd globally.
     os.chdir(overlay)
+    tracking_branch = 'remotes/m/%s' % os.path.basename(options.tracking_branch)
 
     if command == 'clean':
-      Clean(options.tracking_branch)
+      Clean(tracking_branch)
     elif command == 'push':
-      PushChange(STABLE_BRANCH_NAME, options.tracking_branch, options.dryrun)
+      PushChange(STABLE_BRANCH_NAME, tracking_branch, options.dryrun)
     elif command == 'commit' and ebuilds:
-      work_branch = GitBranch(STABLE_BRANCH_NAME, options.tracking_branch)
+      work_branch = GitBranch(STABLE_BRANCH_NAME, tracking_branch)
       work_branch.CreateBranch()
       if not work_branch.Exists():
         Die('Unable to create stabilizing branch in %s' % overlay)