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