comparison hgext/convert/cvsps.py @ 26593:c60dfcc0abf2

cvsps: fix computation of parent revisions when log caching is on cvsps computes the parent revisions of log entries by walking the cvs log sorted by (rcs, revision) and by iteratively maintaining a 'versions' dictionary which maps a (rcs, branch) pair onto the last revision seen for that pair. When log caching is on and a log cache exists, cvsps fails to set the parent revisions of new log entries because it does not iterate over the log cache in the parents computation. A complication is that a file rcs can change (move to/from the attic), with respect to its value in the log cache, if the file is removed/added back. This patch adds an iteration over the log cache to update the rcs of cached log entries, if changed, and to properly populate the 'versions' dictionary.
author Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
date Wed, 07 Oct 2015 11:33:52 +0300
parents 328739ea70c3
children 71176606fa0a
comparison
equal deleted inserted replaced
26592:502b56a9e897 26593:c60dfcc0abf2
205 cmd.append(directory) 205 cmd.append(directory)
206 206
207 # state machine begins here 207 # state machine begins here
208 tags = {} # dictionary of revisions on current file with their tags 208 tags = {} # dictionary of revisions on current file with their tags
209 branchmap = {} # mapping between branch names and revision numbers 209 branchmap = {} # mapping between branch names and revision numbers
210 rcsmap = {}
210 state = 0 211 state = 0
211 store = False # set when a new record can be appended 212 store = False # set when a new record can be appended
212 213
213 cmd = [util.shellquote(arg) for arg in cmd] 214 cmd = [util.shellquote(arg) for arg in cmd]
214 ui.note(_("running %s\n") % (' '.join(cmd))) 215 ui.note(_("running %s\n") % (' '.join(cmd)))
437 branchpoints.add(branch) 438 branchpoints.add(branch)
438 e.branchpoints = branchpoints 439 e.branchpoints = branchpoints
439 440
440 log.append(e) 441 log.append(e)
441 442
443 rcsmap[e.rcs.replace('/Attic/', '/')] = e.rcs
444
442 if len(log) % 100 == 0: 445 if len(log) % 100 == 0:
443 ui.status(util.ellipsis('%d %s' % (len(log), e.file), 80)+'\n') 446 ui.status(util.ellipsis('%d %s' % (len(log), e.file), 80)+'\n')
444 447
445 log.sort(key=lambda x: (x.rcs, x.revision)) 448 log.sort(key=lambda x: (x.rcs, x.revision))
446 449
447 # find parent revisions of individual files 450 # find parent revisions of individual files
448 versions = {} 451 versions = {}
452 for e in sorted(oldlog, key=lambda x: (x.rcs, x.revision)):
453 rcs = e.rcs.replace('/Attic/', '/')
454 if rcs in rcsmap:
455 e.rcs = rcsmap[rcs]
456 branch = e.revision[:-1]
457 versions[(e.rcs, branch)] = e.revision
458
449 for e in log: 459 for e in log:
450 branch = e.revision[:-1] 460 branch = e.revision[:-1]
451 p = versions.get((e.rcs, branch), None) 461 p = versions.get((e.rcs, branch), None)
452 if p is None: 462 if p is None:
453 p = e.revision[:-2] 463 p = e.revision[:-2]