Details
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHG1672c5af1271: lfs: remove pycompat.iteritems()
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
Alphare |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | hgext/lfs/__init__.py (2 lines) | |||
M | hgext/lfs/pointer.py (2 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
dc2e0593c32a | 1836a55a504c | Gregory Szorc | Feb 21 2022, 1:06 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | D12339 ui: use input() directly | |
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg |
ctx = context.resource(mapping, b'ctx') | ctx = context.resource(mapping, b'ctx') | ||||
pointers = wrapper.pointersfromctx(ctx, removed=True) # {path: pointer} | pointers = wrapper.pointersfromctx(ctx, removed=True) # {path: pointer} | ||||
files = sorted(pointers.keys()) | files = sorted(pointers.keys()) | ||||
def pointer(v): | def pointer(v): | ||||
# In the file spec, version is first and the other keys are sorted. | # In the file spec, version is first and the other keys are sorted. | ||||
sortkeyfunc = lambda x: (x[0] != b'version', x) | sortkeyfunc = lambda x: (x[0] != b'version', x) | ||||
items = sorted(pycompat.iteritems(pointers[v]), key=sortkeyfunc) | items = sorted(pointers[v].items(), key=sortkeyfunc) | ||||
return util.sortdict(items) | return util.sortdict(items) | ||||
makemap = lambda v: { | makemap = lambda v: { | ||||
b'file': v, | b'file': v, | ||||
b'lfsoid': pointers[v].oid() if pointers[v] else None, | b'lfsoid': pointers[v].oid() if pointers[v] else None, | ||||
b'lfspointer': templateutil.hybriddict(pointer(v)), | b'lfspointer': templateutil.hybriddict(pointer(v)), | ||||
} | } | ||||
return cls(l.split(b' ', 1) for l in text.splitlines()).validate() | return cls(l.split(b' ', 1) for l in text.splitlines()).validate() | ||||
except ValueError: # l.split returns 1 item instead of 2 | except ValueError: # l.split returns 1 item instead of 2 | ||||
raise InvalidPointer( | raise InvalidPointer( | ||||
_(b'cannot parse git-lfs text: %s') % stringutil.pprint(text) | _(b'cannot parse git-lfs text: %s') % stringutil.pprint(text) | ||||
) | ) | ||||
def serialize(self): | def serialize(self): | ||||
sortkeyfunc = lambda x: (x[0] != b'version', x) | sortkeyfunc = lambda x: (x[0] != b'version', x) | ||||
items = sorted(pycompat.iteritems(self.validate()), key=sortkeyfunc) | items = sorted(self.validate().items(), key=sortkeyfunc) | ||||
return b''.join(b'%s %s\n' % (k, v) for k, v in items) | return b''.join(b'%s %s\n' % (k, v) for k, v in items) | ||||
def oid(self): | def oid(self): | ||||
return self[b'oid'].split(b':')[-1] | return self[b'oid'].split(b':')[-1] | ||||
def size(self): | def size(self): | ||||
return int(self[b'size']) | return int(self[b'size']) | ||||