summaryrefslogtreecommitdiffstats
path: root/subcmds/diffmanifests.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2020-09-06 14:53:18 -0400
committerMike Frysinger <vapier@google.com>2020-11-18 19:10:57 +0000
commit8c1e9cbef161f2ff12dadbacf26affd23876fde9 (patch)
treefcfdc404568a2d8dbc9edd9ec99ecdd758f8c424 /subcmds/diffmanifests.py
parenta488af5ea5c53dd7cf2c90a751e77cc4ba87b7c3 (diff)
downloadgit-repo-8c1e9cbef161f2ff12dadbacf26affd23876fde9.tar.gz
manifest_xml: refactor manifest parsing from client management
We conflate the manifest & parsing logic with the management of the repo client checkout in a single class. This makes testing just one part (the manifest parsing) hard as it requires a full checkout too. Start splitting the two apart into separate classes to make it easy to reason about & test. Change-Id: Iaf897c93db9c724baba6044bfe7a589c024523b2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/288682 Reviewed-by: Michael Mortensen <mmortensen@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/diffmanifests.py')
-rw-r--r--subcmds/diffmanifests.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/subcmds/diffmanifests.py b/subcmds/diffmanifests.py
index 72c441ac..409bbdac 100644
--- a/subcmds/diffmanifests.py
+++ b/subcmds/diffmanifests.py
@@ -16,7 +16,7 @@
16 16
17from color import Coloring 17from color import Coloring
18from command import PagedCommand 18from command import PagedCommand
19from manifest_xml import XmlManifest 19from manifest_xml import RepoClient
20 20
21 21
22class _Coloring(Coloring): 22class _Coloring(Coloring):
@@ -183,7 +183,7 @@ synced and their revisions won't be found.
183 self.OptionParser.error('missing manifests to diff') 183 self.OptionParser.error('missing manifests to diff')
184 184
185 def Execute(self, opt, args): 185 def Execute(self, opt, args):
186 self.out = _Coloring(self.manifest.globalConfig) 186 self.out = _Coloring(self.client.globalConfig)
187 self.printText = self.out.nofmt_printer('text') 187 self.printText = self.out.nofmt_printer('text')
188 if opt.color: 188 if opt.color:
189 self.printProject = self.out.nofmt_printer('project', attr='bold') 189 self.printProject = self.out.nofmt_printer('project', attr='bold')
@@ -193,12 +193,12 @@ synced and their revisions won't be found.
193 else: 193 else:
194 self.printProject = self.printAdded = self.printRemoved = self.printRevision = self.printText 194 self.printProject = self.printAdded = self.printRemoved = self.printRevision = self.printText
195 195
196 manifest1 = XmlManifest(self.manifest.repodir) 196 manifest1 = RepoClient(self.manifest.repodir)
197 manifest1.Override(args[0], load_local_manifests=False) 197 manifest1.Override(args[0], load_local_manifests=False)
198 if len(args) == 1: 198 if len(args) == 1:
199 manifest2 = self.manifest 199 manifest2 = self.manifest
200 else: 200 else:
201 manifest2 = XmlManifest(self.manifest.repodir) 201 manifest2 = RepoClient(self.manifest.repodir)
202 manifest2.Override(args[1], load_local_manifests=False) 202 manifest2.Override(args[1], load_local_manifests=False)
203 203
204 diff = manifest1.projectsDiff(manifest2) 204 diff = manifest1.projectsDiff(manifest2)