Show More
@@ -307,20 +307,27 b' def extractpointers(repo, revs):' | |||||
307 | pointers[p.oid()] = p |
|
307 | pointers[p.oid()] = p | |
308 | return sorted(pointers.values()) |
|
308 | return sorted(pointers.values()) | |
309 |
|
309 | |||
|
310 | def pointerfromctx(ctx, f): | |||
|
311 | """return a pointer for the named file from the given changectx, or None if | |||
|
312 | the file isn't LFS.""" | |||
|
313 | if f not in ctx: | |||
|
314 | return None | |||
|
315 | fctx = ctx[f] | |||
|
316 | if not _islfs(fctx.filelog(), fctx.filenode()): | |||
|
317 | return None | |||
|
318 | try: | |||
|
319 | return pointer.deserialize(fctx.rawdata()) | |||
|
320 | except pointer.InvalidPointer as ex: | |||
|
321 | raise error.Abort(_('lfs: corrupted pointer (%s@%s): %s\n') | |||
|
322 | % (f, short(ctx.node()), ex)) | |||
|
323 | ||||
310 | def pointersfromctx(ctx): |
|
324 | def pointersfromctx(ctx): | |
311 | """return a dict {path: pointer} for given single changectx""" |
|
325 | """return a dict {path: pointer} for given single changectx""" | |
312 | result = {} |
|
326 | result = {} | |
313 | for f in ctx.files(): |
|
327 | for f in ctx.files(): | |
314 | if f not in ctx: |
|
328 | p = pointerfromctx(ctx, f) | |
315 | continue |
|
329 | if p: | |
316 | fctx = ctx[f] |
|
330 | result[f] = p | |
317 | if not _islfs(fctx.filelog(), fctx.filenode()): |
|
|||
318 | continue |
|
|||
319 | try: |
|
|||
320 | result[f] = pointer.deserialize(fctx.rawdata()) |
|
|||
321 | except pointer.InvalidPointer as ex: |
|
|||
322 | raise error.Abort(_('lfs: corrupted pointer (%s@%s): %s\n') |
|
|||
323 | % (f, short(ctx.node()), ex)) |
|
|||
324 | return result |
|
331 | return result | |
325 |
|
332 | |||
326 | def uploadblobs(repo, pointers): |
|
333 | def uploadblobs(repo, pointers): |
General Comments 0
You need to be logged in to leave comments.
Login now