Show More
@@ -165,17 +165,18 b' def deactivate(repo):' | |||
|
165 | 165 | finally: |
|
166 | 166 | wlock.release() |
|
167 | 167 | |
|
168 | def iscurrent(repo, mark=None, parents=None): | |
|
169 | '''Tell whether the current bookmark is also active | |
|
168 | def isactivewdirparent(repo): | |
|
169 | """ | |
|
170 | Tell whether the 'active' bookmark (the one that follows new commits) | |
|
171 | points to one of the parents of the current working directory (wdir). | |
|
170 | 172 | |
|
171 | I.e., the bookmark listed in .hg/bookmarks.current also points to a | |
|
172 | parent of the working directory. | |
|
173 | ''' | |
|
174 | if not mark: | |
|
175 |
|
|
|
176 | if not parents: | |
|
177 | parents = [p.node() for p in repo[None].parents()] | |
|
173 | While this is normally the case, it can on occasion be false; for example, | |
|
174 | immediately after a pull, the active bookmark can be moved to point | |
|
175 | to a place different than the wdir. This is solved by running `hg update`. | |
|
176 | """ | |
|
177 | mark = repo._activebookmark | |
|
178 | 178 | marks = repo._bookmarks |
|
179 | parents = [p.node() for p in repo[None].parents()] | |
|
179 | 180 | return (mark in marks and marks[mark] in parents) |
|
180 | 181 | |
|
181 | 182 | def deletedivergent(repo, deletefrom, bm): |
@@ -201,7 +202,7 b' def calculateupdate(ui, repo, checkout):' | |||
|
201 | 202 | movemarkfrom = None |
|
202 | 203 | if checkout is None: |
|
203 | 204 | curmark = repo._activebookmark |
|
204 |
if is |
|
|
205 | if isactivewdirparent(repo): | |
|
205 | 206 | movemarkfrom = repo['.'].node() |
|
206 | 207 | elif curmark: |
|
207 | 208 | ui.status(_("updating to active bookmark %s\n") % curmark) |
@@ -2721,7 +2721,7 b' def buildcommittext(repo, ctx, subs, ext' | |||
|
2721 | 2721 | edittext.append(_("HG: branch merge")) |
|
2722 | 2722 | if ctx.branch(): |
|
2723 | 2723 | edittext.append(_("HG: branch '%s'") % ctx.branch()) |
|
2724 |
if bookmarks.is |
|
|
2724 | if bookmarks.isactivewdirparent(repo): | |
|
2725 | 2725 | edittext.append(_("HG: bookmark '%s'") % repo._activebookmark) |
|
2726 | 2726 | edittext.extend([_("HG: subrepo %s") % s for s in subs]) |
|
2727 | 2727 | edittext.extend([_("HG: added %s") % f for f in added]) |
@@ -226,7 +226,7 b' def showcurrentbookmark(**args):' | |||
|
226 | 226 | associated with the changeset""" |
|
227 | 227 | import bookmarks as bookmarks # to avoid circular import issues |
|
228 | 228 | repo = args['repo'] |
|
229 |
if bookmarks.is |
|
|
229 | if bookmarks.isactivewdirparent(repo): | |
|
230 | 230 | current = repo._activebookmark |
|
231 | 231 | if current in args['ctx'].bookmarks(): |
|
232 | 232 | return current |
General Comments 0
You need to be logged in to leave comments.
Login now