comparison mercurial/commands.py @ 6646:9eb274d773d9

copies: teach copies about dirstate.copies When we're using copies() to find changes between the working directory and its first parent for diff/status/etc., use dirstate.copies() directly. This avoids doing a full statwalk for simple diffs (issue1090) and removes a special case from the status command.
author Matt Mackall <mpm@selenic.com>
date Tue, 03 Jun 2008 15:41:09 -0500
parents c8c7248f6172
children 7ca74741259f
comparison
equal deleted inserted replaced
6645:37eedb1a1848 6646:9eb274d773d9
2642 stat = repo.status(node1, node2, cmdutil.match(repo, pats, opts), 2642 stat = repo.status(node1, node2, cmdutil.match(repo, pats, opts),
2643 'ignored' in show, 'clean' in show, 'unknown' in show) 2643 'ignored' in show, 'clean' in show, 'unknown' in show)
2644 changestates = zip(states, 'MAR!?IC', stat) 2644 changestates = zip(states, 'MAR!?IC', stat)
2645 2645
2646 if (opts['all'] or opts['copies']) and not opts['no_status']: 2646 if (opts['all'] or opts['copies']) and not opts['no_status']:
2647 if opts.get('rev') == []: 2647 ctxn = repo.changectx(nullid)
2648 # fast path, more correct with merge parents 2648 ctx1 = repo.changectx(node1)
2649 copy = repo.dirstate.copies() 2649 ctx2 = repo.changectx(node2)
2650 else: 2650 added = stat[1]
2651 ctxn = repo.changectx(nullid) 2651 if node2 is None:
2652 ctx1 = repo.changectx(node1) 2652 added = stat[0] + stat[1] # merged?
2653 ctx2 = repo.changectx(node2) 2653 ctx2 = repo.workingctx()
2654 if node2 is None: 2654 for k, v in copies.copies(repo, ctx1, ctx2, ctxn)[0].items():
2655 ctx2 = repo.workingctx() 2655 if k in added:
2656 for k, v in copies.copies(repo, ctx1, ctx2, ctxn)[0].items(): 2656 copy[k] = v
2657 if v in stat[1]: 2657 elif v in added:
2658 copy[v] = k 2658 copy[v] = k
2659 elif k in stat[1]:
2660 copy[k] = v
2661 2659
2662 for state, char, files in changestates: 2660 for state, char, files in changestates:
2663 if state in show: 2661 if state in show:
2664 format = "%s %%s%s" % (char, end) 2662 format = "%s %%s%s" % (char, end)
2665 if opts['no_status']: 2663 if opts['no_status']: