code: def clone(cls, srcpath, destpath):
          
          # Mercurial will not create intermediate directories for clones.
          try:
              os.makedirs(destpath)
          except OSError as e:
              if not e.errno == errno.EEXIST:
                  raise
          cmd = [HG, 'clone', '--quiet', '--noupdate', srcpath, destpath]
          subprocess.check_call(cmd)
          return cls(destpath)
docs: Clone an existing repository to a new bare repository.