scs client: add prefix support for resolving commit ids

Summary:
This improves scs client ux as you can see in the test.

Cross scheme collisions have been already supported in the code, and there will
be a proper message.

For the ambiguity within a single scheme, I added a message.

Reviewed By: mitrandir77

Differential Revision: D19834142

fbshipit-source-id: a2cff44f6ef031b1224ebf13d38d76c66c9ee4b9
This commit is contained in:
Liubov Dmitrieva 2020-02-12 12:00:40 -08:00 committed by Facebook Github Bot
parent 31fde72573
commit 9f71d2cf15

View File

@ -552,6 +552,12 @@ lookup using bonsai needed resolving to identify commit
globalrev=9999999999
hg=ee87eb8cfeb218e7352a94689b241ea973b80402
lookup using bonsai prefix needed resolving to identify commit
$ scsc lookup --repo repo -i 006c988c4a9f60080a6bc2 -S bonsai,hg,globalrev
bonsai=006c988c4a9f60080a6bc2a2fff47565fafea2ca5b16c4d994aecdef0c89973b
globalrev=9999999999
hg=ee87eb8cfeb218e7352a94689b241ea973b80402
lookup using globalrev needed resolving to identify commit
$ scsc lookup --repo repo -i 9999999999 -S bonsai,hg,globalrev
bonsai=006c988c4a9f60080a6bc2a2fff47565fafea2ca5b16c4d994aecdef0c89973b
@ -564,6 +570,18 @@ lookup using hg needed resolving to identify commit
globalrev=9999999999
hg=ee87eb8cfeb218e7352a94689b241ea973b80402
lookup using hg prefix needed resolving to identify commit
$ scsc lookup --repo repo -i ee87eb8 -S bonsai,hg,globalrev
bonsai=006c988c4a9f60080a6bc2a2fff47565fafea2ca5b16c4d994aecdef0c89973b
globalrev=9999999999
hg=ee87eb8cfeb218e7352a94689b241ea973b80402
lookup using hg prefix needed resolving to identify commit (ambiguous case)
$ scsc lookup --repo repo -i e -S bonsai,hg,globalrev
note: several hg commits with the prefix 'e' exist
error: commit not found: e
[1]
cat a file
$ scsc cat --repo repo -B BOOKMARK_B -p a
a