comparison mercurial/subrepo.py @ 24174:bd9f64ec891d

subrepos: support adding files in git subrepos This support includes correct matching, so includes, excludes and patterns are all supported.
author Mathias De Mar? <mathias.demare@gmail.com>
date Tue, 24 Feb 2015 08:49:22 +0100
parents 2cc8ee4c4e1c
children 00ef3edcf1d5
comparison
equal deleted inserted replaced
24173:2cc8ee4c4e1c 24174:bd9f64ec891d
1521 'cannot push revision %s\n') % 1521 'cannot push revision %s\n') %
1522 (self._relpath, self._state[1])) 1522 (self._relpath, self._state[1]))
1523 return False 1523 return False
1524 1524
1525 @annotatesubrepoerror 1525 @annotatesubrepoerror
1526 def add(self, ui, match, prefix, explicitonly, **opts):
1527 if self._gitmissing():
1528 return []
1529 if match.files():
1530 files = match.files()
1531 else:
1532 (modified, added, removed,
1533 deleted, unknown, ignored, clean) = self.status(None)
1534 files = unknown
1535
1536 files = [f for f in files if match(f)]
1537 for f in files:
1538 exact = match.exact(f)
1539 command = ["add"]
1540 if exact:
1541 command.append("-f") #should be added, even if ignored
1542 if ui.verbose or not exact:
1543 ui.status(_('adding %s\n') % match.rel(f))
1544 if not opts.get('dry_run'):
1545 self._gitcommand(command + [f])
1546 return []
1547
1548 @annotatesubrepoerror
1526 def remove(self): 1549 def remove(self):
1527 if self._gitmissing(): 1550 if self._gitmissing():
1528 return 1551 return
1529 if self.dirty(): 1552 if self.dirty():
1530 self.ui.warn(_('not removing repo %s because ' 1553 self.ui.warn(_('not removing repo %s because '