summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--git_superproject.py26
-rw-r--r--subcmds/info.py4
2 files changed, 29 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):
diff --git a/subcmds/info.py b/subcmds/info.py
index f8c2b1e3..2fbdae05 100644
--- a/subcmds/info.py
+++ b/subcmds/info.py
@@ -102,6 +102,10 @@ class Info(PagedCommand):
102 self.heading("Manifest groups: ") 102 self.heading("Manifest groups: ")
103 self.headtext(manifestGroups) 103 self.headtext(manifestGroups)
104 self.out.nl() 104 self.out.nl()
105 sp = self.manifest.superproject
106 srev = sp.commit_id if sp and sp.commit_id else "None"
107 self.heading("Superproject revision: ")
108 self.headtext(srev)
105 109
106 self.printSeparator() 110 self.printSeparator()
107 111