Show More
@@ -4636,12 +4636,6 b' def log(ui, repo, *pats, **opts):' | |||||
4636 | # then filter the result by logcmdutil._makerevset() and --limit |
|
4636 | # then filter the result by logcmdutil._makerevset() and --limit | |
4637 | revs, differ = logcmdutil.getlinerangerevs(repo, revs, opts) |
|
4637 | revs, differ = logcmdutil.getlinerangerevs(repo, revs, opts) | |
4638 |
|
4638 | |||
4639 | if opts.get(b'bookmark'): |
|
|||
4640 | cmdutil.check_at_most_one_arg(opts, b'rev', b'bookmark') |
|
|||
4641 | bookmarks = opts.get(b'bookmark') |
|
|||
4642 | bookmark = bookmarks[0] |
|
|||
4643 | revs, differ = logcmdutil.get_bookmark_revs(repo, bookmark, walk_opts) |
|
|||
4644 |
|
||||
4645 | getcopies = None |
|
4639 | getcopies = None | |
4646 | if opts.get(b'copies'): |
|
4640 | if opts.get(b'copies'): | |
4647 | endrev = None |
|
4641 | endrev = None |
@@ -691,6 +691,7 b' class walkopts(object):' | |||||
691 | revspec = attr.ib() # type: List[bytes] |
|
691 | revspec = attr.ib() # type: List[bytes] | |
692 |
|
692 | |||
693 | # miscellaneous queries to filter revisions (see "hg help log" for details) |
|
693 | # miscellaneous queries to filter revisions (see "hg help log" for details) | |
|
694 | bookmarks = attr.ib(default=attr.Factory(list)) # type: List[bytes] | |||
694 | branches = attr.ib(default=attr.Factory(list)) # type: List[bytes] |
|
695 | branches = attr.ib(default=attr.Factory(list)) # type: List[bytes] | |
695 | date = attr.ib(default=None) # type: Optional[bytes] |
|
696 | date = attr.ib(default=None) # type: Optional[bytes] | |
696 | keywords = attr.ib(default=attr.Factory(list)) # type: List[bytes] |
|
697 | keywords = attr.ib(default=attr.Factory(list)) # type: List[bytes] | |
@@ -746,6 +747,7 b' def parseopts(ui, pats, opts):' | |||||
746 | pats=pats, |
|
747 | pats=pats, | |
747 | opts=opts, |
|
748 | opts=opts, | |
748 | revspec=opts.get(b'rev', []), |
|
749 | revspec=opts.get(b'rev', []), | |
|
750 | bookmarks=opts.get(b'bookmark', []), | |||
749 | # branch and only_branch are really aliases and must be handled at |
|
751 | # branch and only_branch are really aliases and must be handled at | |
750 | # the same time |
|
752 | # the same time | |
751 | branches=opts.get(b'branch', []) + opts.get(b'only_branch', []), |
|
753 | branches=opts.get(b'branch', []) + opts.get(b'only_branch', []), | |
@@ -937,6 +939,14 b' def _makerevset(repo, wopts, slowpath):' | |||||
937 | val = [revsetlang.formatspec(revop, v) for v in val] |
|
939 | val = [revsetlang.formatspec(revop, v) for v in val] | |
938 | expr.append(revsetlang.formatspec(listop, val)) |
|
940 | expr.append(revsetlang.formatspec(listop, val)) | |
939 |
|
941 | |||
|
942 | if wopts.bookmarks: | |||
|
943 | expr.append( | |||
|
944 | revsetlang.formatspec( | |||
|
945 | b'%lr', | |||
|
946 | [scmutil.format_bookmark_revspec(v) for v in wopts.bookmarks], | |||
|
947 | ) | |||
|
948 | ) | |||
|
949 | ||||
940 | if expr: |
|
950 | if expr: | |
941 | expr = b'(' + b' and '.join(expr) + b')' |
|
951 | expr = b'(' + b' and '.join(expr) + b')' | |
942 | else: |
|
952 | else: | |
@@ -1023,26 +1033,6 b' def getrevs(repo, wopts):' | |||||
1023 | return revs, differ |
|
1033 | return revs, differ | |
1024 |
|
1034 | |||
1025 |
|
1035 | |||
1026 | def get_bookmark_revs(repo, bookmark, walk_opts): |
|
|||
1027 | # type: (Any, bookmark, walk_opts) -> Tuple[smartset.abstractsmartset, Optional[changesetdiffer]] |
|
|||
1028 | """Return (revs, differ) where revs is a smartset |
|
|||
1029 |
|
||||
1030 | differ is a changesetdiffer with pre-configured file matcher. |
|
|||
1031 | """ |
|
|||
1032 | revs, filematcher = makewalker(repo, walk_opts) |
|
|||
1033 | if not revs: |
|
|||
1034 | return revs, None |
|
|||
1035 | differ = changesetdiffer() |
|
|||
1036 | differ._makefilematcher = filematcher |
|
|||
1037 |
|
||||
1038 | if bookmark: |
|
|||
1039 | if bookmark not in repo._bookmarks: |
|
|||
1040 | raise error.Abort(_(b"bookmark '%s' not found") % bookmark) |
|
|||
1041 | revs = scmutil.bookmarkrevs(repo, bookmark) |
|
|||
1042 |
|
||||
1043 | return revs, differ |
|
|||
1044 |
|
||||
1045 |
|
||||
1046 | def _parselinerangeopt(repo, opts): |
|
1036 | def _parselinerangeopt(repo, opts): | |
1047 | """Parse --line-range log option and return a list of tuples (filename, |
|
1037 | """Parse --line-range log option and return a list of tuples (filename, | |
1048 | (fromline, toline)). |
|
1038 | (fromline, toline)). |
@@ -125,3 +125,68 b' Check the log of topic X, topic Y, and d' | |||||
125 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
125 | date: Thu Jan 01 00:00:00 1970 +0000 | |
126 | summary: Add foo in 'default' |
|
126 | summary: Add foo in 'default' | |
127 |
|
127 | |||
|
128 | ||||
|
129 | Set up multiple bookmarked heads: | |||
|
130 | ||||
|
131 | $ hg bookmark merged-head | |||
|
132 | $ hg up 1 | |||
|
133 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
134 | (leaving bookmark merged-head) | |||
|
135 | $ echo "Z" > z.txt | |||
|
136 | $ hg ci -Am 'Add Z' | |||
|
137 | adding z.txt | |||
|
138 | $ hg bookmark topic-Z | |||
|
139 | ||||
|
140 | $ hg log -GT '{rev}: {branch}, {bookmarks}\n' | |||
|
141 | @ 5: sebhtml, topic-Z | |||
|
142 | | | |||
|
143 | | o 4: default, merged-head | |||
|
144 | |/| | |||
|
145 | | o 3: default, | |||
|
146 | | |\ | |||
|
147 | | | o 2: sebhtml, sebhtml/99992-topic-Y | |||
|
148 | | |/ | |||
|
149 | o | 1: sebhtml, sebhtml/99991-topic-X | |||
|
150 | |/ | |||
|
151 | o 0: default, | |||
|
152 | ||||
|
153 | ||||
|
154 | Multiple revisions under bookmarked head: | |||
|
155 | ||||
|
156 | $ hg log -GT '{rev}: {branch}, {bookmarks}\n' -B merged-head | |||
|
157 | o 4: default, merged-head | |||
|
158 | |\ | |||
|
159 | | ~ | |||
|
160 | o 3: default, | |||
|
161 | |\ | |||
|
162 | ~ ~ | |||
|
163 | ||||
|
164 | Follows multiple bookmarks: | |||
|
165 | ||||
|
166 | $ hg log -GT '{rev}: {branch}, {bookmarks}\n' -B merged-head -B topic-Z | |||
|
167 | @ 5: sebhtml, topic-Z | |||
|
168 | | | |||
|
169 | ~ | |||
|
170 | o 4: default, merged-head | |||
|
171 | |\ | |||
|
172 | | ~ | |||
|
173 | o 3: default, | |||
|
174 | |\ | |||
|
175 | ~ ~ | |||
|
176 | ||||
|
177 | Filter by bookmark and branch: | |||
|
178 | ||||
|
179 | $ hg log -GT '{rev}: {branch}, {bookmarks}\n' -B merged-head -B topic-Z -b default | |||
|
180 | o 4: default, merged-head | |||
|
181 | |\ | |||
|
182 | | ~ | |||
|
183 | o 3: default, | |||
|
184 | |\ | |||
|
185 | ~ ~ | |||
|
186 | ||||
|
187 | ||||
|
188 | Unknown bookmark: | |||
|
189 | ||||
|
190 | $ hg log -B unknown | |||
|
191 | abort: bookmark 'unknown' does not exist | |||
|
192 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now