comparison hgext/record.py @ 8152:08e1baf924ca

replace set-like dictionaries with real sets Many of the dictionaries created by dict.fromkeys were emulating sets. These can now be replaced with real sets.
author Martin Geisler <mg@lazybytes.net>
date Wed, 22 Apr 2009 00:57:28 +0200
parents 7b813bdbd5d0
children 32a2a1e244f1
comparison
equal deleted inserted replaced
8151:127281884959 8152:08e1baf924ca
420 420
421 # 1. filter patch, so we have intending-to apply subset of it 421 # 1. filter patch, so we have intending-to apply subset of it
422 chunks = filterpatch(ui, parsepatch(fp)) 422 chunks = filterpatch(ui, parsepatch(fp))
423 del fp 423 del fp
424 424
425 contenders = {} 425 contenders = set()
426 for h in chunks: 426 for h in chunks:
427 try: contenders.update(dict.fromkeys(h.files())) 427 try: contenders.update(set(h.files()))
428 except AttributeError: pass 428 except AttributeError: pass
429 429
430 changed = changes[0] + changes[1] + changes[2] 430 changed = changes[0] + changes[1] + changes[2]
431 newfiles = [f for f in changed if f in contenders] 431 newfiles = [f for f in changed if f in contenders]
432 if not newfiles: 432 if not newfiles:
433 ui.status(_('no changes to record\n')) 433 ui.status(_('no changes to record\n'))
434 return 0 434 return 0
435 435
436 modified = dict.fromkeys(changes[0]) 436 modified = set(changes[0])
437 437
438 # 2. backup changed files, so we can restore them in the end 438 # 2. backup changed files, so we can restore them in the end
439 backups = {} 439 backups = {}
440 backupdir = repo.join('record-backups') 440 backupdir = repo.join('record-backups')
441 try: 441 try: