Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 24877:cc497780eaf9 stable
subrepo: propagate the --hidden option to hg subrepositories
With many commands accepting a '-S' or an explicit path to trigger recursing
into subrepos, it seems that --hidden needs to be propagated too.
Unfortunately, many of the subrepo layer methods discard the options map, so
passing the option along explicitly isn't currently an option. It also isn't
clear if other filtered views need to be propagated, so changing all of those
commands may be insufficient anyway.
The specific jam I got into was amending an ancestor of qbase in a subrepo, and
then evolving. The patch ended up being hidden, and outgoing said it would only
push one unrelated commit. But push aborted with an 'unknown revision' that I
traced back to the patch. (Odd it didn't say 'filtered revision'.) A push with
--hidden worked from the subrepo, but that wasn't possible from the parent repo
before this.
Since the underlying problem doesn't actually require a subrepo, there's
probably more to investigate here in the discovery area. Yes, evolve + mq is
not exactly sane, but I don't know what is seeing the hidden revision.
In lieu of creating a test for the above situation (evolving mq should probably
be blocked), the test here is a marginally useful case where --hidden is needed
in a subrepo: cat'ing a file in a hidden revision. Without this change, cat
aborts with:
$ hg --hidden cat subrepo/a
skipping missing subrepository: subrepo
[1]
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 03 Feb 2015 15:01:43 -0500 |
parents | b5513ee85dd8 |
children | 41cd8171e58f |
comparison
equal
deleted
inserted
replaced
24876:b5513ee85dd8 | 24877:cc497780eaf9 |
---|---|
567 self._state = state | 567 self._state = state |
568 r = ctx.repo() | 568 r = ctx.repo() |
569 root = r.wjoin(path) | 569 root = r.wjoin(path) |
570 create = not r.wvfs.exists('%s/.hg' % path) | 570 create = not r.wvfs.exists('%s/.hg' % path) |
571 self._repo = hg.repository(r.baseui, root, create=create) | 571 self._repo = hg.repository(r.baseui, root, create=create) |
572 | |
573 # Propagate the parent's --hidden option | |
574 if r is r.unfiltered(): | |
575 self._repo = self._repo.unfiltered() | |
576 | |
572 self.ui = self._repo.ui | 577 self.ui = self._repo.ui |
573 for s, k in [('ui', 'commitsubrepos')]: | 578 for s, k in [('ui', 'commitsubrepos')]: |
574 v = r.ui.config(s, k) | 579 v = r.ui.config(s, k) |
575 if v: | 580 if v: |
576 self.ui.setconfig(s, k, v, 'subrepo') | 581 self.ui.setconfig(s, k, v, 'subrepo') |