Mercurial > hg
comparison mercurial/repair.py @ 41101:f04e0ca04099
strip: compute bookmark target only if we have bookmark to move
This is a small change that seems to make sense.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 02 Jan 2019 05:07:03 +0100 |
parents | 399010051cf4 |
children | c9a2c4d0e80f |
comparison
equal
deleted
inserted
replaced
41100:399010051cf4 | 41101:f04e0ca04099 |
---|---|
151 obsmarkers = obsutil.exclusivemarkers(repo, stripbases) | 151 obsmarkers = obsutil.exclusivemarkers(repo, stripbases) |
152 if obsmarkers: | 152 if obsmarkers: |
153 stripobsidx = [i for i, m in enumerate(repo.obsstore) | 153 stripobsidx = [i for i, m in enumerate(repo.obsstore) |
154 if m in obsmarkers] | 154 if m in obsmarkers] |
155 | 155 |
156 # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), but | 156 # compute necessary bookmark movement |
157 # is much faster | |
158 newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip) | |
159 if newbmtarget: | |
160 newbmtarget = repo[newbmtarget.first()].node() | |
161 else: | |
162 newbmtarget = '.' | |
163 | |
164 bm = repo._bookmarks | 157 bm = repo._bookmarks |
165 updatebm = [] | 158 updatebm = [] |
166 for m in bm: | 159 for m in bm: |
167 rev = repo[bm[m]].rev() | 160 rev = repo[bm[m]].rev() |
168 if rev in tostrip: | 161 if rev in tostrip: |
169 updatebm.append(m) | 162 updatebm.append(m) |
163 newbmtarget = None | |
164 if updatebm: # don't compute anything is there is no bookmark to move anyway | |
165 # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), | |
166 # but is much faster | |
167 newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip) | |
168 if newbmtarget: | |
169 newbmtarget = repo[newbmtarget.first()].node() | |
170 else: | |
171 newbmtarget = '.' | |
170 | 172 |
171 backupfile = None | 173 backupfile = None |
172 node = nodelist[-1] | 174 node = nodelist[-1] |
173 if backup: | 175 if backup: |
174 backupfile = _createstripbackup(repo, stripbases, node, topic) | 176 backupfile = _createstripbackup(repo, stripbases, node, topic) |