Bug 1270951 - Don't verify "default" path matches; r?jlund draft
authorGregory Szorc <gps@mozilla.com>
Fri, 06 May 2016 14:27:30 -0700
changeset 6857 47892ba4ca6cad98f3ab873b06883682e912fe95
parent 6856 8c00f2d02981402689c1d63c4d3d13c1419414ad
child 6858 bf5d612a59ac912121bc2df86ba4976de64bc5b8
child 6859 09a24c5d9a36bcf41fee2d9b5fbe14882b6aff79
push id63
push usergszorc@mozilla.com
push dateFri, 06 May 2016 22:18:20 +0000
reviewersjlund
bugs1270951
Bug 1270951 - Don't verify "default" path matches; r?jlund This verification was added in 437cce872cb7. We shouldn't need to verify the "default" path matches expectations because the value of the "default" path shouldn't matter: any command not using an explicit URL to define which repo to interact with is buggy because it relies on how a repo came into existence. Distributed version control systems may pull changesets from various sources. As long as the data is available, it shouldn't matter where it came from. So paths shouldn't matter: only data does. The test for recovering from a missing .hg/hgrc has been removed because a .hg/hgrc file should not be required. MozReview-Commit-ID: qlvnJNvV0e
lib/python/mozilla_buildtools/test/test_util_hg.py
lib/python/util/hg.py
--- a/lib/python/mozilla_buildtools/test/test_util_hg.py
+++ b/lib/python/mozilla_buildtools/test/test_util_hg.py
@@ -730,33 +730,16 @@ class TestHg(unittest.TestCase):
         self.assertEquals(p, None)
 
         # cloning again should fix this up
         mercurial(self.repodir, self.wc, shareBase=shareBase)
 
         p = path(self.wc)
         self.assertEquals(p, self.repodir)
 
-    def testBustedHgrc(self):
-        # Test that we can recover from hgrc being lost
-        mercurial(self.repodir, self.wc)
-
-        # Delete .hg/hgrc
-        os.unlink(os.path.join(self.wc, '.hg', 'hgrc'))
-
-        # path is busted now
-        p = path(self.wc)
-        self.assertEquals(p, None)
-
-        # cloning again should fix this up
-        mercurial(self.repodir, self.wc)
-
-        p = path(self.wc)
-        self.assertEquals(p, self.repodir)
-
     def testInit(self):
         tmpdir = os.path.join(self.tmpdir, 'new')
         self.assertEquals(False, os.path.exists(tmpdir))
         init(tmpdir)
         self.assertEquals(True, os.path.exists(tmpdir))
         self.assertEquals(True, os.path.exists(os.path.join(tmpdir, '.hg')))
 
     def testUnbundle(self):
--- a/lib/python/util/hg.py
+++ b/lib/python/util/hg.py
@@ -500,26 +500,16 @@ def mercurial(repo, dest, branch=None, r
                 # Share extension is disabled
                 log.info("Disabling sharing since share extension doesn't seem to work (2)")
                 shareBase = None
         except subprocess.CalledProcessError:
             # The command failed, so disable sharing
             log.info("Disabling sharing since share extension doesn't seem to work (3)")
             shareBase = None
 
-    # Check that our default path is correct
-    if os.path.exists(os.path.join(dest, '.hg')):
-        hgpath = path(dest, "default")
-
-        # Make sure that our default path is correct
-        if not hgpath or _make_absolute(hgpath) != _make_absolute(repo):
-            log.info("hg path isn't correct (%s should be %s); clobbering",
-                     hgpath, _make_absolute(repo))
-            remove_path(dest)
-
     # If the working directory already exists and isn't using share we update
     # the working directory directly from the repo, ignoring the sharing
     # settings
     if os.path.exists(dest):
         if not os.path.exists(os.path.join(dest, ".hg")):
             log.warning("%s doesn't appear to be a valid hg directory; clobbering", dest)
             remove_path(dest)
         elif not os.path.exists(os.path.join(dest, ".hg", "sharedpath")):