bundle2: expose mandatory params in a mandatorykeys attribute
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 23 May 2014 20:23:54 -0700
changeset 21612 f221eb0531d9
parent 21611 71b7b3f79a3c
child 21613 b3213b9fafed
bundle2: expose mandatory params in a mandatorykeys attribute We expose all keys that MUST be processed in ``part.mandatorykeys``. This makes it much easier to access the information. Enforcement of the mandatory parameters is coming in later changesets.
mercurial/bundle2.py
--- a/mercurial/bundle2.py	Mon May 26 18:45:43 2014 -0700
+++ b/mercurial/bundle2.py	Fri May 23 20:23:54 2014 -0700
@@ -690,6 +690,7 @@
         self.mandatoryparams = None
         self.advisoryparams = None
         self.params = None
+        self.mandatorykeys = ()
         self._payloadstream = None
         self._readheader()
 
@@ -715,6 +716,7 @@
         # user friendly UI
         self.params = dict(self.mandatoryparams)
         self.params.update(dict(self.advisoryparams))
+        self.mandatorykeys = frozenset(p[0] for p in mandatoryparams)
 
     def _readheader(self):
         """read the header and setup the object"""