diff --git a/project.py b/project.py index 2ab0b389..e777dbd2 100644 --- a/project.py +++ b/project.py @@ -1216,7 +1216,7 @@ class Project(object): (self.revisionExpr, self.name)) def SetRevisionId(self, revisionId): - if self.clone_depth or self.manifest.manifestProject.config.GetString('repo.depth'): + if self.revisionExpr: self.upstream = self.revisionExpr self.revisionId = revisionId @@ -1967,6 +1967,10 @@ class Project(object): # throws an error. self.bare_git.rev_list('-1', '--missing=allow-any', '%s^0' % self.revisionExpr, '--') + if self.upstream: + rev = self.GetRemote(self.remote.name).ToLocal(self.upstream) + self.bare_git.rev_list('-1', '--missing=allow-any', + '%s^0' % rev, '--') return True except GitError: # There is no such persistent revision. We have to fetch it. diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py index c3f88531..6ff81843 100644 --- a/tests/test_git_superproject.py +++ b/tests/test_git_superproject.py @@ -213,7 +213,7 @@ class SuperprojectTestCase(unittest.TestCase): '' '' '' + 'name="platform/art" path="art" revision="ABCDEF" upstream="refs/heads/main"/>' '' '') @@ -242,7 +242,7 @@ class SuperprojectTestCase(unittest.TestCase): '' '' + 'revision="2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea" upstream="refs/heads/main"/>' '' '') @@ -271,7 +271,7 @@ class SuperprojectTestCase(unittest.TestCase): '' '' '' - '' + '' '') def test_superproject_update_project_revision_id_from_local_manifest_group(self): @@ -316,7 +316,7 @@ class SuperprojectTestCase(unittest.TestCase): '' '' + 'revision="2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea" upstream="refs/heads/main"/>' '' @@ -363,9 +363,9 @@ class SuperprojectTestCase(unittest.TestCase): '' '' + 'revision="2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea" upstream="refs/heads/main"/>' '' + 'revision="e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06" upstream="refs/heads/main"/>' '' '' diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index 2a16900a..55468b51 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py @@ -437,7 +437,7 @@ class ProjectElementTests(ManifestParseTestCase): '' '' '' - '' + '' '') def test_trailing_slash(self):