Mercurial > hg
annotate tests/test-issue1306.t @ 38855:7848f284b211
revisions: allow "x123" to refer to nodeid prefix "123"
When resolving "123" to a revision, we try to interpret it as revnum
before we try to interpret it as a nodeid hex prefix. This can lead to
the shortest valid prefix being longer than necessary. This patch lets
us write such nodeids in a shorter form by prefixing them with "x"
instead of adding more hex digits until they're longer than the
longest decimal revnum.
On my hg repo with almost 69k revisions, turning this feature on saves
on average 0.4% on the average nodeid length. That clearly doesn't
justify this patch. However, it becomes more usefule when combined
with the earlier patches in this series that let you disambiguate
nodeid prefixes within a configured revset.
Note that we attempt to resolve symbols as nodeid prefixes after we've
exhausted all other posibilities, so this is a backwards compatible
change (only queries that would previously fail may now succeed).
I've still hidden this feature behind an experiemntal config option so
we can roll it back if needed.
Differential Revision: https://phab.mercurial-scm.org/D4041
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 29 Apr 2018 10:07:40 -0700 |
parents | eb586ed5d8ce |
children |
rev | line source |
---|---|
26420
2fc86d92c4a9
urls: bulk-change BTS urls to new location
Matt Mackall <mpm@selenic.com>
parents:
15615
diff
changeset
|
1 https://bz.mercurial-scm.org/1306 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
2 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
3 Initialize remote repo with branches: |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
4 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
5 $ hg init remote |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
6 $ cd remote |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
7 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
8 $ echo a > a |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
9 $ hg ci -Ama |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
10 adding a |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
11 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
12 $ hg branch br |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
13 marked working directory as branch br |
15615 | 14 (branches are permanent and global, did you want a bookmark?) |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
15 $ hg ci -Amb |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
16 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
17 $ echo c > c |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
18 $ hg ci -Amc |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
19 adding c |
8452
cb93eee1fbcd
tests: add missing interpreter lines
Martin Geisler <mg@lazybytes.net>
parents:
7045
diff
changeset
|
20 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
21 $ hg log |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
12847
diff
changeset
|
22 changeset: 2:ae3d9c30ec50 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
23 branch: br |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
24 tag: tip |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
25 user: test |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
26 date: Thu Jan 01 00:00:00 1970 +0000 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
27 summary: c |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
28 |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
12847
diff
changeset
|
29 changeset: 1:3f7f930ca414 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
30 branch: br |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
31 user: test |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
32 date: Thu Jan 01 00:00:00 1970 +0000 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
33 summary: b |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
34 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
35 changeset: 0:cb9a9f314b8b |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
36 user: test |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
37 date: Thu Jan 01 00:00:00 1970 +0000 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
38 summary: a |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
39 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
40 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
41 $ cd .. |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
42 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
43 Try cloning -r branch: |
7045
f82938c87b92
clone: honor -r even when pulling named branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
44 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
45 $ hg clone -rbr remote local1 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
46 adding changesets |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
47 adding manifests |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
48 adding file changes |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
49 added 3 changesets with 2 changes to 2 files |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
26420
diff
changeset
|
50 new changesets cb9a9f314b8b:ae3d9c30ec50 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
51 updating to branch br |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
52 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
53 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
54 $ hg -R local1 parents |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
12847
diff
changeset
|
55 changeset: 2:ae3d9c30ec50 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
56 branch: br |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
57 tag: tip |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
58 user: test |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
59 date: Thu Jan 01 00:00:00 1970 +0000 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
60 summary: c |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
61 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
62 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
63 Try cloning -rother clone#branch: |
7045
f82938c87b92
clone: honor -r even when pulling named branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
64 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
65 $ hg clone -r0 remote#br local2 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
66 adding changesets |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
67 adding manifests |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
68 adding file changes |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
69 added 3 changesets with 2 changes to 2 files |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
26420
diff
changeset
|
70 new changesets cb9a9f314b8b:ae3d9c30ec50 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
71 updating to branch default |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
72 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
73 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
74 $ hg -R local2 parents |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
75 changeset: 0:cb9a9f314b8b |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
76 user: test |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
77 date: Thu Jan 01 00:00:00 1970 +0000 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
78 summary: a |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
79 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
80 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
81 Try cloning -r1 clone#branch: |
7045
f82938c87b92
clone: honor -r even when pulling named branches
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
82 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
83 $ hg clone -r1 remote#br local3 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
84 adding changesets |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
85 adding manifests |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
86 adding file changes |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
87 added 3 changesets with 2 changes to 2 files |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
26420
diff
changeset
|
88 new changesets cb9a9f314b8b:ae3d9c30ec50 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
89 updating to branch br |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
91 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
92 $ hg -R local3 parents |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
12847
diff
changeset
|
93 changeset: 1:3f7f930ca414 |
12195
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
94 branch: br |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
95 user: test |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
96 date: Thu Jan 01 00:00:00 1970 +0000 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
97 summary: b |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
98 |
ee41be2bbf5a
tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents:
8452
diff
changeset
|
99 |