Esempio n. 1
0
 def verify(self):
     current_uri = self._run_mercurial(
         ["showconfig", "paths.default"],
         path=self.checkout.directory,
         error=u"Error while reading the current repository path",
     )
     if "#" in current_uri:
         current_uri = current_uri.split("#", 1)[0]
     if not compare_uri(current_uri, self.checkout.uri):
         raise MercurialError(u"Cannot switch to a different repository.")
     current_branch = self._run_mercurial(
         ["branch"], path=self.checkout.directory, error=u"Error while reading the current branch"
     )
     if self.checkout.branch != current_branch:
         return False
     return True
Esempio n. 2
0
 def verify(self):
     xml = self._run_svn(
         ['info', '--xml'],
         path=self.checkout.directory,
         error="Checkout directory is not a valid checkout")
     current_uri, current_root = read_info(xml)
     if current_uri is None:
         raise SubversionError(
             u"Could not read the output",
             self.checkout.directory)
     if not compare_uri(current_uri, self.checkout.uri):
         if not self.checkout.uri.startswith(current_root):
             raise SubversionError(
                 u"Cannot switch to a different repository",
                 current_root, self.checkout.uri)
         return False
     return True