Mercurial > hg
comparison hgext/lfs/__init__.py @ 35999:8c7d5e90e6bd
lfs: teach '{lfs_files}' to handle removed files
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 27 Jan 2018 19:22:15 -0500 |
parents | eefb5d603482 |
children | 91aac8e6604d |
comparison
equal
deleted
inserted
replaced
35998:dce43aaaf209 | 35999:8c7d5e90e6bd |
---|---|
358 return [f for f in mctx.subset | 358 return [f for f in mctx.subset |
359 if wrapper.pointerfromctx(mctx.ctx, f) is not None] | 359 if wrapper.pointerfromctx(mctx.ctx, f) is not None] |
360 | 360 |
361 @templatekeyword('lfs_files') | 361 @templatekeyword('lfs_files') |
362 def lfsfiles(repo, ctx, **args): | 362 def lfsfiles(repo, ctx, **args): |
363 """List of strings. LFS files added or modified by the changeset.""" | 363 """List of strings. All files modified, added, or removed by this |
364 changeset.""" | |
364 args = pycompat.byteskwargs(args) | 365 args = pycompat.byteskwargs(args) |
365 | 366 |
366 pointers = wrapper.pointersfromctx(ctx) # {path: pointer} | 367 pointers = wrapper.pointersfromctx(ctx, removed=True) # {path: pointer} |
367 files = sorted(pointers.keys()) | 368 files = sorted(pointers.keys()) |
368 | 369 |
369 def pointer(v): | 370 def pointer(v): |
370 # In the file spec, version is first and the other keys are sorted. | 371 # In the file spec, version is first and the other keys are sorted. |
371 sortkeyfunc = lambda x: (x[0] != 'version', x) | 372 sortkeyfunc = lambda x: (x[0] != 'version', x) |
372 items = sorted(pointers[v].iteritems(), key=sortkeyfunc) | 373 items = sorted(pointers[v].iteritems(), key=sortkeyfunc) |
373 return util.sortdict(items) | 374 return util.sortdict(items) |
374 | 375 |
375 makemap = lambda v: { | 376 makemap = lambda v: { |
376 'file': v, | 377 'file': v, |
377 'lfsoid': pointers[v].oid(), | 378 'lfsoid': pointers[v].oid() if pointers[v] else None, |
378 'lfspointer': templatekw.hybriddict(pointer(v)), | 379 'lfspointer': templatekw.hybriddict(pointer(v)), |
379 } | 380 } |
380 | 381 |
381 # TODO: make the separator ', '? | 382 # TODO: make the separator ', '? |
382 f = templatekw._showlist('lfs_file', files, args) | 383 f = templatekw._showlist('lfs_file', files, args) |