Add the ability to search for modifications that are staged for commit.
authormatthew_hanson@apple.com <matthew_hanson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Nov 2014 04:49:46 +0000 (04:49 +0000)
committermatthew_hanson@apple.com <matthew_hanson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Nov 2014 04:49:46 +0000 (04:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138373

This makes is easy to do identify files that require merge post-processing,
in addition to stand-alone utility.

Reviewed by NOBODY (OOPS!).

* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.modifications_staged_for_commit): Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175604 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/common/checkout/scm/git.py

index 71fdd308da6f063132f90844bae0daf08e466eb3..3e237b0ef6b63116b49d15d37c0aafd9091294c3 100644 (file)
@@ -1,3 +1,16 @@
+2014-11-04  Matthew Hanson  <matthew_hanson@apple.com>
+
+        Add the ability to search for modifications that are staged for commit.
+        https://bugs.webkit.org/show_bug.cgi?id=138373
+
+        Reviewed by Ryosuke Niwa and Daniel Bates.
+
+        This makes is easy to do identify files that require merge post-processing,
+        in addition to stand-alone utility.
+
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        (Git.modifications_staged_for_commit): Added.
+
 2014-11-04  Matthew Hanson  <matthew_hanson@apple.com>
 
         Add a branch keyword argument to _run_git_svn_find_rev.
 2014-11-04  Matthew Hanson  <matthew_hanson@apple.com>
 
         Add a branch keyword argument to _run_git_svn_find_rev.
index de163df8cd963707719cc218fe2c41db10e0326f..1775fe3a27045241f6524658ba26440476454452 100644 (file)
@@ -207,6 +207,13 @@ class Git(SCM, SVNRepository):
 
         return self.remote_merge_base()
 
 
         return self.remote_merge_base()
 
+    def modifications_staged_for_commit(self):
+        # This will only return non-deleted files with the "updated in index" status
+        # as defined by http://git-scm.com/docs/git-status.
+        status_command = [self.executable_name, 'status', '--short']
+        updated_in_index_regexp = '^M[ M] (?P<filename>.+)$'
+        return self.run_status_and_extract_filenames(status_command, updated_in_index_regexp)
+
     def changed_files(self, git_commit=None):
         # FIXME: --diff-filter could be used to avoid the "extract_filenames" step.
         status_command = [self.executable_name, 'diff', '-r', '--name-status', "--no-renames", "--no-ext-diff", "--full-index", self.merge_base(git_commit)]
     def changed_files(self, git_commit=None):
         # FIXME: --diff-filter could be used to avoid the "extract_filenames" step.
         status_command = [self.executable_name, 'diff', '-r', '--name-status', "--no-renames", "--no-ext-diff", "--full-index", self.merge_base(git_commit)]