mercurial/commands.py
changeset 2931 0843bd53dcff
parent 2922 773c5b82d052
child 2942 f4fc0575e8fa
equal deleted inserted replaced
2930:af71034aac90 2931:0843bd53dcff
  1524     follow = opts.get('follow')
  1524     follow = opts.get('follow')
  1525     for st, rev, fns in changeiter:
  1525     for st, rev, fns in changeiter:
  1526         if st == 'window':
  1526         if st == 'window':
  1527             incrementing = rev
  1527             incrementing = rev
  1528             matches.clear()
  1528             matches.clear()
  1529             copies.clear()
       
  1530         elif st == 'add':
  1529         elif st == 'add':
  1531             change = repo.changelog.read(repo.lookup(str(rev)))
  1530             change = repo.changelog.read(repo.lookup(str(rev)))
  1532             mf = repo.manifest.read(change[0])
  1531             mf = repo.manifest.read(change[0])
  1533             matches[rev] = {}
  1532             matches[rev] = {}
  1534             for fn in fns:
  1533             for fn in fns:
  1535                 if fn in skip:
  1534                 if fn in skip:
  1536                     continue
  1535                     continue
  1537                 fstate.setdefault(fn, {})
  1536                 fstate.setdefault(fn, {})
  1538                 copies.setdefault(rev, {})
       
  1539                 try:
  1537                 try:
  1540                     grepbody(fn, rev, getfile(fn).read(mf[fn]))
  1538                     grepbody(fn, rev, getfile(fn).read(mf[fn]))
  1541                     if follow:
  1539                     if follow:
  1542                         copied = getfile(fn).renamed(mf[fn])
  1540                         copied = getfile(fn).renamed(mf[fn])
  1543                         if copied:
  1541                         if copied:
  1544                             copies[rev][fn] = copied[0]
  1542                             copies.setdefault(rev, {})[fn] = copied[0]
  1545                 except KeyError:
  1543                 except KeyError:
  1546                     pass
  1544                     pass
  1547         elif st == 'iter':
  1545         elif st == 'iter':
  1548             states = matches[rev].items()
  1546             states = matches[rev].items()
  1549             states.sort()
  1547             states.sort()
  1550             for fn, m in states:
  1548             for fn, m in states:
  1551                 copy = copies[rev].get(fn)
  1549                 copy = copies.get(rev, {}).get(fn)
  1552                 if fn in skip:
  1550                 if fn in skip:
  1553                     if copy:
  1551                     if copy:
  1554                         skip[copy] = True
  1552                         skip[copy] = True
  1555                     continue
  1553                     continue
  1556                 if incrementing or not opts['all'] or fstate[fn]:
  1554                 if incrementing or not opts['all'] or fstate[fn]:
  1569         fstate = fstate.items()
  1567         fstate = fstate.items()
  1570         fstate.sort()
  1568         fstate.sort()
  1571         for fn, state in fstate:
  1569         for fn, state in fstate:
  1572             if fn in skip:
  1570             if fn in skip:
  1573                 continue
  1571                 continue
  1574             if fn not in copies[prev[fn]]:
  1572             if fn not in copies.get(prev[fn], {}):
  1575                 display(fn, rev, {}, state)
  1573                 display(fn, rev, {}, state)
  1576     return (count == 0 and 1) or 0
  1574     return (count == 0 and 1) or 0
  1577 
  1575 
  1578 def heads(ui, repo, **opts):
  1576 def heads(ui, repo, **opts):
  1579     """show current repository heads
  1577     """show current repository heads