mercurial/bundlerepo.py
changeset 50199 21f876895dfe
parent 50198 a6a8946d5173
child 50200 197204dba8a2
--- a/mercurial/bundlerepo.py	Thu Feb 23 19:06:24 2023 +0100
+++ b/mercurial/bundlerepo.py	Thu Feb 23 19:07:58 2023 +0100
@@ -327,6 +327,14 @@
                 _(b'bundle type %s cannot be read') % type(bundle)
             )
 
+    def _handle_bundle1(self, bundle, bundlepath):
+        if bundle.compressed():
+            f = self._writetempbundle(bundle.read, b'.hg10un', header=b'HG10UN')
+            bundle = exchange.readbundle(self.ui, f, bundlepath, self.vfs)
+
+        self._bundlefile = bundle
+        self._cgunpacker = bundle
+
         self.firstnewrev = self.changelog.repotiprev + 1
         phases.retractboundary(
             self,
@@ -335,14 +343,6 @@
             [ctx.node() for ctx in self[self.firstnewrev :]],
         )
 
-    def _handle_bundle1(self, bundle, bundlepath):
-        if bundle.compressed():
-            f = self._writetempbundle(bundle.read, b'.hg10un', header=b'HG10UN')
-            bundle = exchange.readbundle(self.ui, f, bundlepath, self.vfs)
-
-        self._bundlefile = bundle
-        self._cgunpacker = bundle
-
     def _handle_bundle2_cg_part(self, bundle, part):
         assert part.type == b'changegroup'
         cgstream = part
@@ -356,6 +356,14 @@
 
         self._cgunpacker = changegroup.getunbundler(version, cgstream, b'UN')
 
+        self.firstnewrev = self.changelog.repotiprev + 1
+        phases.retractboundary(
+            self,
+            None,
+            phases.draft,
+            [ctx.node() for ctx in self[self.firstnewrev :]],
+        )
+
     def _writetempbundle(self, readfn, suffix, header=b''):
         """Write a temporary file to disk"""
         fdtemp, temp = self.vfs.mkstemp(prefix=b"hg-bundle-", suffix=suffix)