Index: tools/autoroller/roll_chromium_revision.py |
diff --git a/tools/autoroller/roll_chromium_revision.py b/tools/autoroller/roll_chromium_revision.py |
index 57937ed82ee3e6042245524bd3271a9bd940b433..981f1aef79ec424e9d61490612010b7c019ca9c2 100755 |
--- a/tools/autoroller/roll_chromium_revision.py |
+++ b/tools/autoroller/roll_chromium_revision.py |
@@ -289,6 +289,13 @@ def UpdateDeps(deps_filename, old_cr_revision, new_cr_revision): |
with open(deps_filename, 'wb') as deps_file: |
deps_file.write(deps_content) |
+def _IsTreeClean(): |
+ stdout, _ = _RunCommand(['git', 'status', '--porcelain']) |
+ if len(stdout) == 0: |
+ return True |
+ |
+ logging.error('Dirty/unversioned files:\n%s', stdout) |
+ return False |
def _CreateRollBranch(dry_run): |
current_branch = _RunCommand( |
@@ -298,6 +305,9 @@ def _CreateRollBranch(dry_run): |
if not dry_run: |
sys.exit(-1) |
+ logging.info('Updating master branch...') |
+ if not dry_run: |
+ _RunCommand(['git', 'pull']) |
logging.info('Creating roll branch: %s', ROLL_BRANCH_NAME) |
if not dry_run: |
_RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME]) |
@@ -353,6 +363,10 @@ def main(): |
else: |
logging.basicConfig(level=logging.INFO) |
+ if not _IsTreeClean(): |
+ logging.error('Please clean your local checkout first.') |
+ return 1 |
+ |
if opts.clean: |
_RemovePreviousRollBranch(opts.dry_run) |