[PATCH] Add ability to clone from all-history bundles

Matt Mackall mpm at selenic.com
Mon Mar 10 19:23:16 CDT 2008


On Mon, 2008-03-10 at 19:30 -0400, John Mulligan wrote:
> try #2
> 
> # HG changeset patch
> # User John Mulligan <phlogistonjohn at asynchrono.us>
> # Date 1205190859 14400
> # Node ID 9f3ed715452ea1b726a682b98432b886c7d333f1
> # Parent  d2353ed8b153eb38dc804b704aa73b7edd4315bb
> Add ability to clone from all-history bundles
> - Don't copy a bundle like a normal localrepo on clone
> - bundlerepos can be cloned from, if CWD is not a repo
> 
> diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
> --- a/mercurial/bundlerepo.py
> +++ b/mercurial/bundlerepo.py
> @@ -12,8 +12,8 @@
>  
>  from node import hex, nullid, short
>  from i18n import _
> -import changegroup, util, os, struct, bz2, tempfile, mdiff
> -import localrepo, changelog, manifest, filelog, revlog
> +import changegroup, util, os, struct, bz2, tempfile, shutil, mdiff
> +import repo, localrepo, changelog, manifest, filelog, revlog
>  
>  class bundlerevlog(revlog.revlog):
>      def __init__(self, opener, indexfile, bundlefile,
> @@ -152,7 +152,13 @@
>  
>  class bundlerepository(localrepo.localrepository):
>      def __init__(self, ui, path, bundlename):
> -        localrepo.localrepository.__init__(self, ui, path)
> +        _tempparent = None

self._tempparent, the above is just a local variable.

> +        tempparent = getattr(self, '_tempparent', None)

Heh. If we actually set self._tempparent as above, this silliness isn't
needed.

> -        if src_repo.local() and islocal(dest):
> +        bundlesrc = isinstance(src_repo, bundlerepo.bundlerepository)
> +        if src_repo.local() and islocal(dest) and not bundlesrc:
>              abspath = os.path.abspath(util.drop_scheme('file', origsource))
>              copy = not pull and not rev

Which is fine until we add the next thing that we can't simply copy. 
Instead, we should add a cancopy() method. But I suppose this'll do for
now.
 
-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list