lfs: clarify pointer validation error messages
It wasn't obvious that LFS was involved from the error messages when `hg verify`
fails.
--- a/hgext/lfs/pointer.py Tue May 22 23:22:15 2018 -0400
+++ b/hgext/lfs/pointer.py Thu Apr 26 23:00:19 2018 -0400
@@ -65,17 +65,19 @@
for k, v in self.iteritems():
if k in self._requiredre:
if not self._requiredre[k].match(v):
- raise InvalidPointer(_('unexpected value: %s=%s')
- % (k, stringutil.pprint(v)))
+ raise InvalidPointer(
+ _('unexpected lfs pointer value: %s=%s')
+ % (k, stringutil.pprint(v)))
requiredcount += 1
elif not self._keyre.match(k):
- raise InvalidPointer(_('unexpected key: %s') % k)
+ raise InvalidPointer(_('unexpected lfs pointer key: %s') % k)
if not self._valuere.match(v):
- raise InvalidPointer(_('unexpected value: %s=%s')
+ raise InvalidPointer(_('unexpected lfs pointer value: %s=%s')
% (k, stringutil.pprint(v)))
if len(self._requiredre) != requiredcount:
miss = sorted(set(self._requiredre.keys()).difference(self.keys()))
- raise InvalidPointer(_('missed keys: %s') % ', '.join(miss))
+ raise InvalidPointer(_('missing lfs pointer keys: %s')
+ % ', '.join(miss))
return self
deserialize = gitlfspointer.deserialize
--- a/tests/test-lfs-pointer.py.out Tue May 22 23:22:15 2018 -0400
+++ b/tests/test-lfs-pointer.py.out Thu Apr 26 23:00:19 2018 -0400
@@ -1,12 +1,12 @@
-missed keys: oid, size
+missing lfs pointer keys: oid, size
ok
-unexpected value: version='https://unknown.github.com/spec/v1'
+unexpected lfs pointer value: version='https://unknown.github.com/spec/v1'
cannot parse git-lfs text: 'version https://git-lfs.github.com/spec/v1\n\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 12345\nx-foo extra-information\n'
-unexpected value: oid='ahs256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
-unexpected value: oid='4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
-unexpected value: size='0x12345'
+unexpected lfs pointer value: oid='ahs256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
+unexpected lfs pointer value: oid='4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393'
+unexpected lfs pointer value: size='0x12345'
ok
cannot parse git-lfs text: 'version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 12345\nx-foo extra\ninformation\n'
-unexpected key: x_foo
-missed keys: oid
-missed keys: oid, size
+unexpected lfs pointer key: x_foo
+missing lfs pointer keys: oid
+missing lfs pointer keys: oid, size