summaryrefslogtreecommitdiffstats
path: root/git_superproject.py
diff options
context:
space:
mode:
Diffstat (limited to 'git_superproject.py')
-rw-r--r--git_superproject.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/git_superproject.py b/git_superproject.py
index aba836a3..a557879c 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -130,6 +130,29 @@ class Superproject:
130 self._print_messages = value 130 self._print_messages = value
131 131
132 @property 132 @property
133 def commit_id(self):
134 """Returns the commit ID of the superproject checkout."""
135 cmd = ["rev-parse", self.revision]
136 p = GitCommand(
137 None, # project
138 cmd,
139 gitdir=self._work_git,
140 bare=True,
141 capture_stdout=True,
142 capture_stderr=True,
143 )
144 retval = p.Wait()
145 if retval != 0:
146 self._LogWarning(
147 "git rev-parse call failed, command: git {}, "
148 "return code: {}, stderr: {}",
149 cmd,
150 p.stdwerr,
151 )
152 return None
153 return p.stdout
154
155 @property
133 def project_commit_ids(self): 156 def project_commit_ids(self):
134 """Returns a dictionary of projects and their commit ids.""" 157 """Returns a dictionary of projects and their commit ids."""
135 return self._project_commit_ids 158 return self._project_commit_ids
@@ -276,7 +299,7 @@ class Superproject:
276 Works only in git repositories. 299 Works only in git repositories.
277 300
278 Returns: 301 Returns:
279 data: data returned from 'git ls-tree ...' instead of None. 302 data: data returned from 'git ls-tree ...'. None on error.
280 """ 303 """
281 if not os.path.exists(self._work_git): 304 if not os.path.exists(self._work_git):
282 self._LogWarning( 305 self._LogWarning(
@@ -306,6 +329,7 @@ class Superproject:
306 retval, 329 retval,
307 p.stderr, 330 p.stderr,
308 ) 331 )
332 return None
309 return data 333 return data
310 334
311 def Sync(self, git_event_log): 335 def Sync(self, git_event_log):