mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-06-01 23:49:46 +00:00
git_superproject: Remove redundant _branch variable
Both variables were initialized to the same value and never modified. Bug: 416589884 Change-Id: Iaa1ffffb4543d4cd9391ac679d9234fe01678861 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/576921 Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
committed by
gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
134eeb024b
commit
12cfc6036a
+6
-5
@@ -100,7 +100,7 @@ class Superproject:
|
|||||||
self._manifest = manifest
|
self._manifest = manifest
|
||||||
self.name = name
|
self.name = name
|
||||||
self.remote = remote
|
self.remote = remote
|
||||||
self.revision = self._branch = revision
|
self.revision = revision
|
||||||
self._repodir = manifest.repodir
|
self._repodir = manifest.repodir
|
||||||
self._superproject_dir = superproject_dir
|
self._superproject_dir = superproject_dir
|
||||||
self._superproject_path = manifest.SubmanifestInfoDir(
|
self._superproject_path = manifest.SubmanifestInfoDir(
|
||||||
@@ -199,7 +199,8 @@ class Superproject:
|
|||||||
def _LogMessagePrefix(self):
|
def _LogMessagePrefix(self):
|
||||||
"""Returns the prefix string to be logged in each log message"""
|
"""Returns the prefix string to be logged in each log message"""
|
||||||
return (
|
return (
|
||||||
f"repo superproject branch: {self._branch} url: {self._remote_url}"
|
f"repo superproject revision: {self.revision} "
|
||||||
|
f"url: {self._remote_url}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def _LogError(self, fmt, *inputs):
|
def _LogError(self, fmt, *inputs):
|
||||||
@@ -312,8 +313,8 @@ class Superproject:
|
|||||||
if rev_commit:
|
if rev_commit:
|
||||||
cmd.extend(["--negotiation-tip", rev_commit])
|
cmd.extend(["--negotiation-tip", rev_commit])
|
||||||
|
|
||||||
if self._branch:
|
if self.revision:
|
||||||
cmd += [self._branch + ":" + self._branch]
|
cmd += [self.revision + ":" + self.revision]
|
||||||
p = GitCommand(
|
p = GitCommand(
|
||||||
None,
|
None,
|
||||||
cmd,
|
cmd,
|
||||||
@@ -348,7 +349,7 @@ class Superproject:
|
|||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
data = None
|
data = None
|
||||||
branch = "HEAD" if not self._branch else self._branch
|
branch = "HEAD" if not self.revision else self.revision
|
||||||
cmd = ["ls-tree", "-z", "-r", branch]
|
cmd = ["ls-tree", "-z", "-r", branch]
|
||||||
|
|
||||||
p = GitCommand(
|
p = GitCommand(
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class SuperprojectTestCase(unittest.TestCase):
|
|||||||
),
|
),
|
||||||
revision="refs/heads/main",
|
revision="refs/heads/main",
|
||||||
)
|
)
|
||||||
with mock.patch.object(self._superproject, "_branch", "junk"):
|
with mock.patch.object(self._superproject, "revision", "junk"):
|
||||||
sync_result = self._superproject.Sync(self.git_event_log)
|
sync_result = self._superproject.Sync(self.git_event_log)
|
||||||
self.assertFalse(sync_result.success)
|
self.assertFalse(sync_result.success)
|
||||||
self.assertTrue(sync_result.fatal)
|
self.assertTrue(sync_result.fatal)
|
||||||
|
|||||||
Reference in New Issue
Block a user