mercurial/subrepo.py
changeset 23523 01a8dfc79cdc
parent 23522 49a58b33d1ce
child 23536 fcbc66b5da6a
equal deleted inserted replaced
23522:49a58b33d1ce 23523:01a8dfc79cdc
  1591                 unknown.append(line)
  1591                 unknown.append(line)
  1592 
  1592 
  1593         return scmutil.status(modified, added, removed, deleted,
  1593         return scmutil.status(modified, added, removed, deleted,
  1594                               unknown, ignored, clean)
  1594                               unknown, ignored, clean)
  1595 
  1595 
       
  1596     @annotatesubrepoerror
       
  1597     def diff(self, ui, diffopts, node2, match, prefix, **opts):
       
  1598         node1 = self._state[1]
       
  1599         cmd = ['diff']
       
  1600         if opts['stat']:
       
  1601             cmd.append('--stat')
       
  1602         else:
       
  1603             # for Git, this also implies '-p'
       
  1604             cmd.append('-U%d' % diffopts.context)
       
  1605 
       
  1606         gitprefix = os.path.join(prefix, self._path)
       
  1607 
       
  1608         if diffopts.noprefix:
       
  1609             cmd.extend(['--src-prefix=%s/' % gitprefix,
       
  1610                         '--dst-prefix=%s/' % gitprefix])
       
  1611         else:
       
  1612             cmd.extend(['--src-prefix=a/%s/' % gitprefix,
       
  1613                         '--dst-prefix=b/%s/' % gitprefix])
       
  1614 
       
  1615         if diffopts.ignorews:
       
  1616             cmd.append('--ignore-all-space')
       
  1617         if diffopts.ignorewsamount:
       
  1618             cmd.append('--ignore-space-change')
       
  1619         if self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4) \
       
  1620                 and diffopts.ignoreblanklines:
       
  1621             cmd.append('--ignore-blank-lines')
       
  1622 
       
  1623         cmd.append(node1)
       
  1624         if node2:
       
  1625             cmd.append(node2)
       
  1626 
       
  1627         if match.anypats():
       
  1628             return #No support for include/exclude yet
       
  1629 
       
  1630         if match.always():
       
  1631             ui.write(self._gitcommand(cmd))
       
  1632         elif match.files():
       
  1633             for f in match.files():
       
  1634                 ui.write(self._gitcommand(cmd + [f]))
       
  1635         elif match(gitprefix): #Subrepo is matched
       
  1636             ui.write(self._gitcommand(cmd))
       
  1637 
  1596     def shortid(self, revid):
  1638     def shortid(self, revid):
  1597         return revid[:7]
  1639         return revid[:7]
  1598 
  1640 
  1599 types = {
  1641 types = {
  1600     'hg': hgsubrepo,
  1642     'hg': hgsubrepo,