mercurial/hg.py
changeset 2613 479e26afa10f
parent 2612 ffb895f16925
child 2621 5a5852a417b1
equal deleted inserted replaced
2612:ffb895f16925 2613:479e26afa10f
    72         except TypeError:
    72         except TypeError:
    73             raise util.Abort(_('cannot create new repository over "%s" protocol') %
    73             raise util.Abort(_('cannot create new repository over "%s" protocol') %
    74                              scheme)
    74                              scheme)
    75     return ctor(ui, path)
    75     return ctor(ui, path)
    76 
    76 
    77 def clone(ui, source, dest=None, pull=False, rev=None, update=True):
    77 def clone(ui, source, dest=None, pull=False, rev=None, update=True,
       
    78           stream=False):
    78     """Make a copy of an existing repository.
    79     """Make a copy of an existing repository.
    79 
    80 
    80     Create a copy of an existing repository in a new directory.  The
    81     Create a copy of an existing repository in a new directory.  The
    81     source and destination are URLs, as passed to the repository
    82     source and destination are URLs, as passed to the repository
    82     function.  Returns a pair of repository objects, the source and
    83     function.  Returns a pair of repository objects, the source and
    93 
    94 
    94     dest: URL of destination repository to create (defaults to base
    95     dest: URL of destination repository to create (defaults to base
    95     name of source repository)
    96     name of source repository)
    96 
    97 
    97     pull: always pull from source repository, even in local case
    98     pull: always pull from source repository, even in local case
       
    99 
       
   100     stream: stream from repository (fast over LAN, slow over WAN)
    98 
   101 
    99     rev: revision to clone up to (implies pull=True)
   102     rev: revision to clone up to (implies pull=True)
   100 
   103 
   101     update: update working directory after clone completes, if
   104     update: update working directory after clone completes, if
   102     destination is local repository
   105     destination is local repository
   177                 raise util.Abort(_("clone by revision not supported yet "
   180                 raise util.Abort(_("clone by revision not supported yet "
   178                                    "for remote repositories"))
   181                                    "for remote repositories"))
   179             revs = [src_repo.lookup(r) for r in rev]
   182             revs = [src_repo.lookup(r) for r in rev]
   180 
   183 
   181         if dest_repo.local():
   184         if dest_repo.local():
   182             dest_repo.clone(src_repo, heads=revs, pull=pull)
   185             dest_repo.clone(src_repo, heads=revs, stream=stream)
   183         elif src_repo.local():
   186         elif src_repo.local():
   184             src_repo.push(dest_repo, revs=revs)
   187             src_repo.push(dest_repo, revs=revs)
   185         else:
   188         else:
   186             raise util.Abort(_("clone from remote to remote not supported"))
   189             raise util.Abort(_("clone from remote to remote not supported"))
   187 
   190