strip: don't allow empty changegroup in bundle1
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 30 Jun 2017 23:58:31 -0700
changeset 33307 665271d601f5
parent 33306 a9808bd1449e
child 33308 248d5890c80a
strip: don't allow empty changegroup in bundle1 Applying an empty changegroup has been an error since the beginning. The only exception was strip, which would allow to apply an empty changegroup from the temporary bundle. However, the emptyok=True option was only set for bundle1 bundles. In other words, temporary bundle2 bundles would fail if they were empty. Bundle2 has now been used enough that it seems safe to say that we simply don't create bundle2 bundles with empty changegroups. That also suggests that we never create bundle1 bundles with empty changegroups (i.e. empty bundle1 bundles, since bundle1 is just a changegroup), because, AFAICT, the code leading up to the application of the bundle is the same for bundle1 and bundle2. Therefore, let's stop passing emptyok=True, so we more clearly get the same behavior for bundle1 and bundle2.
mercurial/repair.py
--- a/mercurial/repair.py	Thu Jun 08 22:49:21 2017 -0700
+++ b/mercurial/repair.py	Fri Jun 30 23:58:31 2017 -0700
@@ -213,7 +213,7 @@
                 txnname = "strip\n%s" % util.hidepassword(tmpbundleurl)
             with repo.transaction(txnname) as tr:
                 bundle2.applybundle(repo, gen, tr, source='strip',
-                                    url=tmpbundleurl, emptyok=True)
+                                    url=tmpbundleurl)
             if not repo.ui.verbose:
                 repo.ui.popbuffer()
             f.close()