##// END OF EJS Templates
lfs: clarify pointer validation error messages...
Matt Harbison -
r38178:aa10675c default
parent child Browse files
Show More
@@ -65,17 +65,19 b' class gitlfspointer(dict):'
65 65 for k, v in self.iteritems():
66 66 if k in self._requiredre:
67 67 if not self._requiredre[k].match(v):
68 raise InvalidPointer(_('unexpected value: %s=%s')
69 % (k, stringutil.pprint(v)))
68 raise InvalidPointer(
69 _('unexpected lfs pointer value: %s=%s')
70 % (k, stringutil.pprint(v)))
70 71 requiredcount += 1
71 72 elif not self._keyre.match(k):
72 raise InvalidPointer(_('unexpected key: %s') % k)
73 raise InvalidPointer(_('unexpected lfs pointer key: %s') % k)
73 74 if not self._valuere.match(v):
74 raise InvalidPointer(_('unexpected value: %s=%s')
75 raise InvalidPointer(_('unexpected lfs pointer value: %s=%s')
75 76 % (k, stringutil.pprint(v)))
76 77 if len(self._requiredre) != requiredcount:
77 78 miss = sorted(set(self._requiredre.keys()).difference(self.keys()))
78 raise InvalidPointer(_('missed keys: %s') % ', '.join(miss))
79 raise InvalidPointer(_('missing lfs pointer keys: %s')
80 % ', '.join(miss))
79 81 return self
80 82
81 83 deserialize = gitlfspointer.deserialize
@@ -1,12 +1,12 b''
1 missed keys: oid, size
1 missing lfs pointer keys: oid, size
2 2 ok
3 unexpected value: version='https://unknown.github.com/spec/v1'
3 unexpected lfs pointer value: version='https://unknown.github.com/spec/v1'
4 4 cannot parse git-lfs text: 'version https://git-lfs.github.com/spec/v1\n\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 12345\nx-foo extra-information\n'
5 unexpected value: oid='ahs256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
6 unexpected value: oid='4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
7 unexpected value: size='0x12345'
5 unexpected lfs pointer value: oid='ahs256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
6 unexpected lfs pointer value: oid='4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
7 unexpected lfs pointer value: size='0x12345'
8 8 ok
9 9 cannot parse git-lfs text: 'version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 12345\nx-foo extra\ninformation\n'
10 unexpected key: x_foo
11 missed keys: oid
12 missed keys: oid, size
10 unexpected lfs pointer key: x_foo
11 missing lfs pointer keys: oid
12 missing lfs pointer keys: oid, size
General Comments 0
You need to be logged in to leave comments. Login now