comparison mercurial/commands.py @ 15775:91eb4512edd0

copies: rewrite copy detection for non-merge users The existing copy detection API was designed with merge in mind and was ill-suited for doing status/diff. The new pathcopies implementation gives more accurate, easier to use results for comparing two revisions, and is much simpler to understand. Test notes: - test-mv-cp-st.t results finds more renames in the reverse direction now - test-mq-merge.t was always wrong and duplicated a copy in diff that was already present in one of the parent revisions
author Matt Mackall <mpm@selenic.com>
date Wed, 04 Jan 2012 17:55:30 -0600
parents 0bd17a4bed88
children 12309c09d19a
comparison
equal deleted inserted replaced
15774:0bd17a4bed88 15775:91eb4512edd0
5204 'ignored' in show, 'clean' in show, 'unknown' in show, 5204 'ignored' in show, 'clean' in show, 'unknown' in show,
5205 opts.get('subrepos')) 5205 opts.get('subrepos'))
5206 changestates = zip(states, 'MAR!?IC', stat) 5206 changestates = zip(states, 'MAR!?IC', stat)
5207 5207
5208 if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'): 5208 if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'):
5209 ctx1 = repo[node1] 5209 copy = copies.pathcopies(repo[node1], repo[node2])
5210 ctx2 = repo[node2]
5211 added = stat[1]
5212 if node2 is None:
5213 added = stat[0] + stat[1] # merged?
5214
5215 for k, v in copies.pathcopies(ctx1, ctx2).iteritems():
5216 if k in added:
5217 copy[k] = v
5218 elif v in added:
5219 copy[v] = k
5220 5210
5221 for state, char, files in changestates: 5211 for state, char, files in changestates:
5222 if state in show: 5212 if state in show:
5223 format = "%s %%s%s" % (char, end) 5213 format = "%s %%s%s" % (char, end)
5224 if opts.get('no_status'): 5214 if opts.get('no_status'):