[PATCH 2 of 3] Fix income/pull with bundle and -R. Adds an additional "mainrepo" parameter to
mpm at selenic.com
Mon Dec 3 09:35:17 CST 2007
On Mon, Dec 03, 2007 at 02:27:31PM +0100, Peter Arrenbrecht wrote:
> On Nov 30, 2007 11:12 PM, Matt Mackall <mpm at selenic.com> wrote:
> > On Fri, Nov 30, 2007 at 01:16:15PM +0100, Peter Arrenbrecht wrote:
> > > -def instance(ui, path, create):
> > > +def instance(ui, path, create, mainrepo=None):
> > Could we simply always pass a mainrepo? I like to avoid default
> > arguments where possible.
> Sure, if you say so. I wasn't sure if this was an API extensions would
> be likely to use. But if they only use hg.repository, then that's
> fine. I take it this then applies to all repository classes.
> > > - other = hg.repository(ui, source)
> > > + other = hg.repository(ui, source, mainrepo=repo)
> > > ui.status(_('comparing with %s\n') % util.hidepassword(source))
> > > if revs:
> > > revs = [other.lookup(rev) for rev in revs]
> > Not using the default
> I don't understand what you mean here. The default would be None, no?
I'm just pointing out that you added a default argument and then
-always- used it. In which case it should be a normal argument.
> > Again, not using the default.
> > On the other hand, it seems messy fiddling with this mainrepo thing.
> > It might be better for the -R switch to inform hg.py of where things
> > are happening and have hg.py manage this bit internally?
> I know. But I also have misgivings about adding such global state to
> hg.py. How about teaching ui about the default repo location? This
> could then be set here (dispatch.py):
> rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
> if rpath:
> path = lui.expandpath(rpath[-1])
> lui = _ui.ui(parentui=ui)
> lui.readconfig(os.path.join(path, ".hg", "hgrc"))
> and used in bundlerepo.instance. All the mainrepo rahrah would go away
> as the current ui passed to *.instance.
That could be ok too. But someone could do something weird like set
the default path in their .hg/hgrc, which might make a mess of things.
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel