diff mercurial/bundlerepo.py @ 28714:dac81729fea4

bundle: warn when update to revision existing only in a bundle (issue5004) Now its done silently, so unless user really knows what he is doing will be suprised to find that after update 'hg status' doesn't work. This commit makes also merge operation warns about missing parent when revision to merge exists only in the bundle.
author liscju <piotr.listkiewicz@gmail.com>
date Wed, 23 Mar 2016 08:55:22 +0100
parents ae53ecc47414
children 98e8313dcd9e
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Wed Mar 30 21:54:26 2016 +0200
+++ b/mercurial/bundlerepo.py	Wed Mar 23 08:55:22 2016 +0100
@@ -32,6 +32,7 @@
     localrepo,
     manifest,
     mdiff,
+    node as nodemod,
     pathutil,
     phases,
     revlog,
@@ -385,6 +386,16 @@
     def getcwd(self):
         return os.getcwd() # always outside the repo
 
+    # Check if parents exist in localrepo before setting
+    def setparents(self, p1, p2=nullid):
+        p1rev = self.changelog.rev(p1)
+        p2rev = self.changelog.rev(p2)
+        msg = _("setting parent to node %s that only exists in the bundle\n")
+        if self.changelog.repotiprev < p1rev:
+            self.ui.warn(msg % nodemod.hex(p1))
+        if self.changelog.repotiprev < p2rev:
+            self.ui.warn(msg % nodemod.hex(p2))
+        return super(bundlerepository, self).setparents(p1, p2)
 
 def instance(ui, path, create):
     if create: