D1382: bundlerepo: use early return

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Nov 17 17:22:20 EST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2b1373d8ef93: bundlerepo: use early return (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1382?vs=3460&id=3609

REVISION DETAIL
  https://phab.mercurial-scm.org/D1382

AFFECTED FILES
  mercurial/bundlerepo.py

CHANGE DETAILS

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -319,19 +319,19 @@
                                [ctx.node() for ctx in self[self.firstnewrev:]])
 
     def _handlebundle2part(self, bundle, part):
-        if part.type == 'changegroup':
-            cgstream = part
-            version = part.params.get('version', '01')
-            legalcgvers = changegroup.supportedincomingversions(self)
-            if version not in legalcgvers:
-                msg = _('Unsupported changegroup version: %s')
-                raise error.Abort(msg % version)
-            if bundle.compressed():
-                cgstream = self._writetempbundle(part.read,
-                                                 ".cg%sun" % version)
+        if part.type != 'changegroup':
+            return
 
-            self._cgunpacker = changegroup.getunbundler(version, cgstream,
-                                                         'UN')
+        cgstream = part
+        version = part.params.get('version', '01')
+        legalcgvers = changegroup.supportedincomingversions(self)
+        if version not in legalcgvers:
+            msg = _('Unsupported changegroup version: %s')
+            raise error.Abort(msg % version)
+        if bundle.compressed():
+            cgstream = self._writetempbundle(part.read, '.cg%sun' % version)
+
+        self._cgunpacker = changegroup.getunbundler(version, cgstream, 'UN')
 
     def _writetempbundle(self, readfn, suffix, header=''):
         """Write a temporary file to disk



To: indygreg, #hg-reviewers, dlax, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list