comparison mercurial/metadata.py @ 45942:89a2afe31e82

formating: upgrade to black 20.8b1 This required a couple of small tweaks to un-confuse black, but now it works. Big formatting changes come from: * Dramatically improved collection-splitting logic upstream * Black having a strong (correct IMO) opinion that """ is better than ''' Differential Revision: https://phab.mercurial-scm.org/D9430
author Augie Fackler <raf@durin42.com>
date Fri, 27 Nov 2020 17:03:29 -0500
parents 18c17d63fdab
children 59fa3890d40a
comparison
equal deleted inserted replaced
45941:346af7687c6f 45942:89a2afe31e82
252 else: 252 else:
253 return _process_merge(p1, p2, ctx) 253 return _process_merge(p1, p2, ctx)
254 254
255 255
256 def _process_root(ctx): 256 def _process_root(ctx):
257 """compute the appropriate changed files for a changeset with no parents 257 """compute the appropriate changed files for a changeset with no parents"""
258 """
259 # Simple, there was nothing before it, so everything is added. 258 # Simple, there was nothing before it, so everything is added.
260 md = ChangingFiles() 259 md = ChangingFiles()
261 manifest = ctx.manifest() 260 manifest = ctx.manifest()
262 for filename in manifest: 261 for filename in manifest:
263 md.mark_added(filename) 262 md.mark_added(filename)
264 return md 263 return md
265 264
266 265
267 def _process_linear(parent_ctx, children_ctx, parent=1): 266 def _process_linear(parent_ctx, children_ctx, parent=1):
268 """compute the appropriate changed files for a changeset with a single parent 267 """compute the appropriate changed files for a changeset with a single parent"""
269 """
270 md = ChangingFiles() 268 md = ChangingFiles()
271 parent_manifest = parent_ctx.manifest() 269 parent_manifest = parent_ctx.manifest()
272 children_manifest = children_ctx.manifest() 270 children_manifest = children_ctx.manifest()
273 271
274 copies_candidate = [] 272 copies_candidate = []
513 def _missing_from_all_ancestors(mas, filename): 511 def _missing_from_all_ancestors(mas, filename):
514 return all(_find(ma, filename) is None for ma in mas) 512 return all(_find(ma, filename) is None for ma in mas)
515 513
516 514
517 def computechangesetfilesadded(ctx): 515 def computechangesetfilesadded(ctx):
518 """return the list of files added in a changeset 516 """return the list of files added in a changeset"""
519 """
520 added = [] 517 added = []
521 for f in ctx.files(): 518 for f in ctx.files():
522 if not any(f in p for p in ctx.parents()): 519 if not any(f in p for p in ctx.parents()):
523 added.append(f) 520 added.append(f)
524 return added 521 return added
578 575
579 return deletionfromparent 576 return deletionfromparent
580 577
581 578
582 def computechangesetfilesremoved(ctx): 579 def computechangesetfilesremoved(ctx):
583 """return the list of files removed in a changeset 580 """return the list of files removed in a changeset"""
584 """
585 removed = [] 581 removed = []
586 for f in ctx.files(): 582 for f in ctx.files():
587 if f not in ctx: 583 if f not in ctx:
588 removed.append(f) 584 removed.append(f)
589 if removed: 585 if removed:
591 removed = [r for r in removed if not rf(r)] 587 removed = [r for r in removed if not rf(r)]
592 return removed 588 return removed
593 589
594 590
595 def computechangesetfilesmerged(ctx): 591 def computechangesetfilesmerged(ctx):
596 """return the list of files merged in a changeset 592 """return the list of files merged in a changeset"""
597 """
598 merged = [] 593 merged = []
599 if len(ctx.parents()) < 2: 594 if len(ctx.parents()) < 2:
600 return merged 595 return merged
601 for f in ctx.files(): 596 for f in ctx.files():
602 if f in ctx: 597 if f in ctx: