Mercurial > hg
comparison tests/test-revset.t @ 32684:af854b1b36f8
revlog: add support for partial matching of wdir node id
The idea is simple. If the given node id prefix is 'ff...f', add +1 to the
number of matches (e.g. ambiguous if partial + maybewdir > 1).
This patch also fixes id() revset and shortest() template since _partialmatch()
can raise WdirUnsupported exception.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 19 Aug 2016 18:26:04 +0900 |
parents | 9f840d99054c |
children | f75d0aa5dc83 |
comparison
equal
deleted
inserted
replaced
32683:9f840d99054c | 32684:af854b1b36f8 |
---|---|
1287 2147483647 | 1287 2147483647 |
1288 $ hg debugrevspec '0:wdir() & rev(2147483647)' | 1288 $ hg debugrevspec '0:wdir() & rev(2147483647)' |
1289 2147483647 | 1289 2147483647 |
1290 $ hg debugrevspec '0:wdir() & ffffffffffffffffffffffffffffffffffffffff' | 1290 $ hg debugrevspec '0:wdir() & ffffffffffffffffffffffffffffffffffffffff' |
1291 2147483647 | 1291 2147483647 |
1292 $ hg debugrevspec '0:wdir() & ffffffffffff' | |
1293 2147483647 | |
1292 $ hg debugrevspec '0:wdir() & id(ffffffffffffffffffffffffffffffffffffffff)' | 1294 $ hg debugrevspec '0:wdir() & id(ffffffffffffffffffffffffffffffffffffffff)' |
1293 2147483647 | 1295 2147483647 |
1294 $ hg debugrevspec '0:wdir() & id(ffffffffffff)' | 1296 $ hg debugrevspec '0:wdir() & id(ffffffffffff)' |
1295 BROKEN: should be '2147483647' | 1297 2147483647 |
1298 | |
1299 $ cd .. | |
1300 | |
1301 Test short 'ff...' hash collision | |
1302 (BUG: '0:wdir()' is still needed to populate wdir revision) | |
1303 | |
1304 $ hg init wdir-hashcollision | |
1305 $ cd wdir-hashcollision | |
1306 $ cat <<EOF >> .hg/hgrc | |
1307 > [experimental] | |
1308 > evolution = createmarkers | |
1309 > EOF | |
1310 $ echo 0 > a | |
1311 $ hg ci -qAm 0 | |
1312 $ for i in 2463 2961 6726 78127; do | |
1313 > hg up -q 0 | |
1314 > echo $i > a | |
1315 > hg ci -qm $i | |
1316 > done | |
1317 $ hg up -q null | |
1318 $ hg log -r '0:wdir()' -T '{rev}:{node} {shortest(node, 3)}\n' | |
1319 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a b4e | |
1320 1:fffbae3886c8fbb2114296380d276fd37715d571 fffba | |
1321 2:fffb6093b00943f91034b9bdad069402c834e572 fffb6 | |
1322 3:fff48a9b9de34a4d64120c29548214c67980ade3 fff4 | |
1323 4:ffff85cff0ff78504fcdc3c0bc10de0c65379249 ffff8 | |
1324 2147483647:ffffffffffffffffffffffffffffffffffffffff fffff | |
1325 $ hg debugobsolete fffbae3886c8fbb2114296380d276fd37715d571 | |
1326 | |
1327 $ hg debugrevspec '0:wdir() & fff' | |
1328 abort: 00changelog.i@fff: ambiguous identifier! | |
1329 [255] | |
1330 $ hg debugrevspec '0:wdir() & ffff' | |
1331 abort: 00changelog.i@ffff: ambiguous identifier! | |
1332 [255] | |
1333 $ hg debugrevspec '0:wdir() & fffb' | |
1334 abort: 00changelog.i@fffb: ambiguous identifier! | |
1335 [255] | |
1336 BROKEN should be '2' (node lookup uses unfiltered repo since dc25ed84bee8) | |
1337 $ hg debugrevspec '0:wdir() & id(fffb)' | |
1338 2 | |
1339 $ hg debugrevspec '0:wdir() & ffff8' | |
1340 4 | |
1341 $ hg debugrevspec '0:wdir() & fffff' | |
1342 2147483647 | |
1343 | |
1344 $ cd .. | |
1296 | 1345 |
1297 Test branch() with wdir() | 1346 Test branch() with wdir() |
1347 | |
1348 $ cd repo | |
1298 | 1349 |
1299 $ log '0:wdir() & branch("literal:é")' | 1350 $ log '0:wdir() & branch("literal:é")' |
1300 8 | 1351 8 |
1301 9 | 1352 9 |
1302 2147483647 | 1353 2147483647 |