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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py

Issue 2590693002: Only add unstaged baseline changes to the git index when rebaselining. (Closed)
Patch Set: rebaseline-cl: Abort if there are unstaged baseline changes. Created 4 years 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 | third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
index 374259ce90f0215ced6d9a4cab908031f918cf07..dc790442463defccbd0b90f9f4ab79a8fd9d93aa 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
@@ -112,6 +112,24 @@ class Git(SCM):
if self._rebase_in_progress():
self._run_git(['rebase', '--abort'])
+ def unstaged_changes(self):
+ """Lists files with unstaged changes, including untracked files.
+
+ Returns a dict mapping modified file paths (relative to checkout root)
+ to one-character codes identifying the change, e.g. 'M' for modified,
+ 'D' for deleted, '?' for untracked.
+ """
+ # `git status -z` is a version of `git status -s`, that's recommended
+ # for machine parsing. Lines are terminated with NUL rather than LF.
+ unstaged_changes = {}
+ change_lines = self._run_git(['status', '-z']).rstrip('\x00').split('\x00')
+ for line in change_lines:
+ if line[1] == ' ':
+ continue # Already staged for commit.
+ path = line[3:]
+ unstaged_changes[path] = line[1]
+ return unstaged_changes
+
def status_command(self):
# git status returns non-zero when there are changes, so we use git diff name --name-status HEAD instead.
# No file contents printed, thus utf-8 autodecoding in self.run is fine.
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698