Revert "Error out of rebase-update if there are uncommitted changes"

This reverts commit eff810e93d.

Reason for revert: breaks workflows for users

Original change's description:
> Error out of rebase-update if there are uncommitted changes
>
> Currently, running rebase-update may lead to missing untracked files.
> This change prints an error instead freezing and thawing local changes.
>
> Bug: 1251047
> Change-Id: Ia5f718ed957dae936d2ead2778760ae0c8d9f9ea
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3171828
> Commit-Queue: Gavin Mak <gavinmak@google.com>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>

Bug: 1251047
Change-Id: I5b61dc1c7af13ccca6ea80baecff0522291083c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3191674
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
Gavin Mak
2021-09-28 21:11:29 +00:00
committed by LUCI CQ
parent d2fe58c115
commit 9450767ac3
2 changed files with 22 additions and 7 deletions

View File

@@ -256,9 +256,12 @@ def main(args=None):
return_branch, return_workdir = find_return_branch_workdir()
os.chdir(git.run('rev-parse', '--show-toplevel'))
if git.run('status', '--porcelain'):
print('Cannot rebase-update with uncommitted changes.')
return 1
if git.current_branch() == 'HEAD':
if git.run('status', '--porcelain'):
print('Cannot rebase-update with detached head + uncommitted changes.')
return 1
else:
git.freeze() # just in case there are any local changes.
branches_to_rebase = set(opts.branches)
if opts.current:
@@ -319,6 +322,7 @@ def main(args=None):
# return_branch may not be there any more.
if return_branch in git.branches():
git.run('checkout', return_branch)
git.thaw()
else:
root_branch = git.root()
if return_branch != 'HEAD':