Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGed046348675c: subrepo: adjust subrepo prefix before calling subrepo.add() (API)
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/cmdutil.py (5 lines) | |||
M | mercurial/subrepo.py (4 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Feb 7 2019, 12:59 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
if ui.verbose or not exact: | if ui.verbose or not exact: | ||||
ui.status(_('adding %s\n') % match.rel(f), | ui.status(_('adding %s\n') % match.rel(f), | ||||
label='ui.addremove.added') | label='ui.addremove.added') | ||||
for subpath in sorted(wctx.substate): | for subpath in sorted(wctx.substate): | ||||
sub = wctx.sub(subpath) | sub = wctx.sub(subpath) | ||||
try: | try: | ||||
submatch = matchmod.subdirmatcher(subpath, match) | submatch = matchmod.subdirmatcher(subpath, match) | ||||
subprefix = repo.wvfs.reljoin(prefix, subpath) | |||||
if opts.get(r'subrepos'): | if opts.get(r'subrepos'): | ||||
bad.extend(sub.add(ui, submatch, prefix, False, **opts)) | bad.extend(sub.add(ui, submatch, subprefix, False, **opts)) | ||||
else: | else: | ||||
bad.extend(sub.add(ui, submatch, prefix, True, **opts)) | bad.extend(sub.add(ui, submatch, subprefix, True, **opts)) | ||||
except error.LookupError: | except error.LookupError: | ||||
ui.status(_("skipping missing subrepository: %s\n") | ui.status(_("skipping missing subrepository: %s\n") | ||||
% join(subpath)) | % join(subpath)) | ||||
if not opts.get(r'dry_run'): | if not opts.get(r'dry_run'): | ||||
rejected = wctx.add(names, prefix) | rejected = wctx.add(names, prefix) | ||||
bad.extend(f for f in rejected if f in match.files()) | bad.extend(f for f in rejected if f in match.files()) | ||||
return bad | return bad |
addpathconfig('default', defpath) | addpathconfig('default', defpath) | ||||
if defpath != defpushpath: | if defpath != defpushpath: | ||||
addpathconfig('default-push', defpushpath) | addpathconfig('default-push', defpushpath) | ||||
self._repo.vfs.write('hgrc', util.tonativeeol(''.join(lines))) | self._repo.vfs.write('hgrc', util.tonativeeol(''.join(lines))) | ||||
@annotatesubrepoerror | @annotatesubrepoerror | ||||
def add(self, ui, match, prefix, explicitonly, **opts): | def add(self, ui, match, prefix, explicitonly, **opts): | ||||
return cmdutil.add(ui, self._repo, match, | return cmdutil.add(ui, self._repo, match, prefix, explicitonly, **opts) | ||||
self.wvfs.reljoin(prefix, self._path), | |||||
explicitonly, **opts) | |||||
@annotatesubrepoerror | @annotatesubrepoerror | ||||
def addremove(self, m, prefix, opts): | def addremove(self, m, prefix, opts): | ||||
# In the same way as sub directories are processed, once in a subrepo, | # In the same way as sub directories are processed, once in a subrepo, | ||||
# always entry any of its subrepos. Don't corrupt the options that will | # always entry any of its subrepos. Don't corrupt the options that will | ||||
# be used to process sibling subrepos however. | # be used to process sibling subrepos however. | ||||
opts = copy.copy(opts) | opts = copy.copy(opts) | ||||
opts['subrepos'] = True | opts['subrepos'] = True |