Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 41650:f8b18583049f
add: pass around uipathfn and use instead of m.rel() (API)
For now, the uipathfn we pass around always prints relative paths just
like before, so this should have no effect. Well, there's one little
change: I also made the "skipping missing subrepository: %s\n" message
relative.
Differential Revision: https://phab.mercurial-scm.org/D5901
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 07 Feb 2019 11:15:30 -0800 |
parents | d8cdd5320f75 |
children | b2df5dc3ebfb |
comparison
equal
deleted
inserted
replaced
41649:799e156785f7 | 41650:f8b18583049f |
---|---|
285 | 285 |
286 This may be a no-op on some systems. | 286 This may be a no-op on some systems. |
287 """ | 287 """ |
288 raise NotImplementedError | 288 raise NotImplementedError |
289 | 289 |
290 def add(self, ui, match, prefix, explicitonly, **opts): | 290 def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): |
291 return [] | 291 return [] |
292 | 292 |
293 def addremove(self, matcher, prefix, opts): | 293 def addremove(self, matcher, prefix, opts): |
294 self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) | 294 self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) |
295 return 1 | 295 return 1 |
514 addpathconfig('default-push', defpushpath) | 514 addpathconfig('default-push', defpushpath) |
515 | 515 |
516 self._repo.vfs.write('hgrc', util.tonativeeol(''.join(lines))) | 516 self._repo.vfs.write('hgrc', util.tonativeeol(''.join(lines))) |
517 | 517 |
518 @annotatesubrepoerror | 518 @annotatesubrepoerror |
519 def add(self, ui, match, prefix, explicitonly, **opts): | 519 def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): |
520 return cmdutil.add(ui, self._repo, match, prefix, explicitonly, **opts) | 520 return cmdutil.add(ui, self._repo, match, prefix, uipathfn, |
521 explicitonly, **opts) | |
521 | 522 |
522 @annotatesubrepoerror | 523 @annotatesubrepoerror |
523 def addremove(self, m, prefix, opts): | 524 def addremove(self, m, prefix, opts): |
524 # In the same way as sub directories are processed, once in a subrepo, | 525 # In the same way as sub directories are processed, once in a subrepo, |
525 # always entry any of its subrepos. Don't corrupt the options that will | 526 # always entry any of its subrepos. Don't corrupt the options that will |
1588 'cannot push revision %s\n') % | 1589 'cannot push revision %s\n') % |
1589 (self._relpath, self._state[1])) | 1590 (self._relpath, self._state[1])) |
1590 return False | 1591 return False |
1591 | 1592 |
1592 @annotatesubrepoerror | 1593 @annotatesubrepoerror |
1593 def add(self, ui, match, prefix, explicitonly, **opts): | 1594 def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): |
1594 if self._gitmissing(): | 1595 if self._gitmissing(): |
1595 return [] | 1596 return [] |
1596 | 1597 |
1597 s = self.status(None, unknown=True, clean=True) | 1598 s = self.status(None, unknown=True, clean=True) |
1598 | 1599 |
1612 exact = match.exact(f) | 1613 exact = match.exact(f) |
1613 command = ["add"] | 1614 command = ["add"] |
1614 if exact: | 1615 if exact: |
1615 command.append("-f") #should be added, even if ignored | 1616 command.append("-f") #should be added, even if ignored |
1616 if ui.verbose or not exact: | 1617 if ui.verbose or not exact: |
1617 ui.status(_('adding %s\n') % match.rel(f)) | 1618 ui.status(_('adding %s\n') % uipathfn(f)) |
1618 | 1619 |
1619 if f in tracked: # hg prints 'adding' even if already tracked | 1620 if f in tracked: # hg prints 'adding' even if already tracked |
1620 if exact: | 1621 if exact: |
1621 rejected.append(f) | 1622 rejected.append(f) |
1622 continue | 1623 continue |
1623 if not opts.get(r'dry_run'): | 1624 if not opts.get(r'dry_run'): |
1624 self._gitcommand(command + [f]) | 1625 self._gitcommand(command + [f]) |
1625 | 1626 |
1626 for f in rejected: | 1627 for f in rejected: |
1627 ui.warn(_("%s already tracked!\n") % match.rel(f)) | 1628 ui.warn(_("%s already tracked!\n") % uipathfn(f)) |
1628 | 1629 |
1629 return rejected | 1630 return rejected |
1630 | 1631 |
1631 @annotatesubrepoerror | 1632 @annotatesubrepoerror |
1632 def remove(self): | 1633 def remove(self): |