Mercurial > hg
comparison tests/test-log-bookmark.t @ 45900:0aa118f18d4b
log: add bookmark option to "hg log"
Before pushing a bookmark with "hg push origin -B 'my-topic'", it is useful to inspect
the list of commits that are ancestors of the bookmark.
By relying on scmutil.bookmarkrevs(), "hg log -B topic" has the same bookmark semantics
found in other commands like hg export, hg email, hg strip.
Differential Revision: https://phab.mercurial-scm.org/D9341
author | Sebastien Boisvert <sebhtml@protonmail.com> |
---|---|
date | Tue, 17 Nov 2020 21:30:50 -0500 |
parents | |
children | 9c0db3671008 |
comparison
equal
deleted
inserted
replaced
45899:f96059fa519c | 45900:0aa118f18d4b |
---|---|
1 Test 'hg log' with a bookmark | |
2 | |
3 | |
4 Create the repository | |
5 | |
6 $ hg init Test-D8973 | |
7 $ cd Test-D8973 | |
8 $ echo "bar" > foo.txt | |
9 $ hg add foo.txt | |
10 $ hg commit -m "Add foo in 'default'" | |
11 | |
12 | |
13 Add a bookmark for topic X | |
14 | |
15 $ hg branch -f sebhtml | |
16 marked working directory as branch sebhtml | |
17 (branches are permanent and global, did you want a bookmark?) | |
18 | |
19 $ hg bookmark sebhtml/99991-topic-X | |
20 $ hg up sebhtml/99991-topic-X | |
21 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
22 | |
23 $ echo "X" > x.txt | |
24 $ hg add x.txt | |
25 $ hg commit -m "Add x.txt in 'sebhtml/99991-topic-X'" | |
26 | |
27 $ hg log -B sebhtml/99991-topic-X | |
28 changeset: 1:29f39dea9bf9 | |
29 branch: sebhtml | |
30 bookmark: sebhtml/99991-topic-X | |
31 tag: tip | |
32 user: test | |
33 date: Thu Jan 01 00:00:00 1970 +0000 | |
34 summary: Add x.txt in 'sebhtml/99991-topic-X' | |
35 | |
36 | |
37 Add a bookmark for topic Y | |
38 | |
39 $ hg update default | |
40 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
41 (leaving bookmark sebhtml/99991-topic-X) | |
42 | |
43 $ echo "Y" > y.txt | |
44 $ hg add y.txt | |
45 $ hg branch -f sebhtml | |
46 marked working directory as branch sebhtml | |
47 $ hg bookmark sebhtml/99992-topic-Y | |
48 $ hg up sebhtml/99992-topic-Y | |
49 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
50 $ hg commit -m "Add y.txt in 'sebhtml/99992-topic-Y'" | |
51 created new head | |
52 | |
53 $ hg log -B sebhtml/99992-topic-Y | |
54 changeset: 2:11df7969cf8d | |
55 branch: sebhtml | |
56 bookmark: sebhtml/99992-topic-Y | |
57 tag: tip | |
58 parent: 0:eaea25376a59 | |
59 user: test | |
60 date: Thu Jan 01 00:00:00 1970 +0000 | |
61 summary: Add y.txt in 'sebhtml/99992-topic-Y' | |
62 | |
63 | |
64 The log of topic Y does not interfere with the log of topic X | |
65 | |
66 $ hg log -B sebhtml/99991-topic-X | |
67 changeset: 1:29f39dea9bf9 | |
68 branch: sebhtml | |
69 bookmark: sebhtml/99991-topic-X | |
70 user: test | |
71 date: Thu Jan 01 00:00:00 1970 +0000 | |
72 summary: Add x.txt in 'sebhtml/99991-topic-X' | |
73 | |
74 | |
75 Merge topics Y and X in the default branch | |
76 | |
77 $ hg update default | |
78 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
79 (leaving bookmark sebhtml/99992-topic-Y) | |
80 | |
81 $ hg bookmark | |
82 sebhtml/99991-topic-X 1:29f39dea9bf9 | |
83 sebhtml/99992-topic-Y 2:11df7969cf8d | |
84 | |
85 $ hg merge sebhtml/99992-topic-Y | |
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
87 (branch merge, don't forget to commit) | |
88 | |
89 $ hg commit -m "Merge branch 'sebhtml/99992-topic-Y' into 'default'" | |
90 | |
91 $ hg update default | |
92 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
93 | |
94 $ hg merge sebhtml/99991-topic-X | |
95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
96 (branch merge, don't forget to commit) | |
97 | |
98 $ hg commit -m "Merge branch 'sebhtml/99991-topic-X' into 'default'" | |
99 | |
100 | |
101 Check the log of topic X, topic Y, and default branch | |
102 | |
103 $ hg log -B sebhtml/99992-topic-Y | |
104 | |
105 $ hg log -B sebhtml/99991-topic-X | |
106 | |
107 $ hg log -b default | |
108 changeset: 4:c26ba8c1e1cb | |
109 tag: tip | |
110 parent: 3:2189f3fb90d6 | |
111 parent: 1:29f39dea9bf9 | |
112 user: test | |
113 date: Thu Jan 01 00:00:00 1970 +0000 | |
114 summary: Merge branch 'sebhtml/99991-topic-X' into 'default' | |
115 | |
116 changeset: 3:2189f3fb90d6 | |
117 parent: 0:eaea25376a59 | |
118 parent: 2:11df7969cf8d | |
119 user: test | |
120 date: Thu Jan 01 00:00:00 1970 +0000 | |
121 summary: Merge branch 'sebhtml/99992-topic-Y' into 'default' | |
122 | |
123 changeset: 0:eaea25376a59 | |
124 user: test | |
125 date: Thu Jan 01 00:00:00 1970 +0000 | |
126 summary: Add foo in 'default' | |
127 |