##// END OF EJS Templates
bookmarks: mark divergent bookmarks with book@pathalias when source in [paths]
Matt Mackall -
r15614:260a6449 default
parent child Browse files
Show More
@@ -177,7 +177,7 def pushbookmark(repo, key, old, new):
177 177 finally:
178 178 w.release()
179 179
180 def updatefromremote(ui, repo, remote):
180 def updatefromremote(ui, repo, remote, path):
181 181 ui.debug("checking for updated bookmarks\n")
182 182 rb = remote.listkeys('bookmarks')
183 183 changed = False
@@ -194,10 +194,17 def updatefromremote(ui, repo, remote):
194 194 changed = True
195 195 ui.status(_("updating bookmark %s\n") % k)
196 196 else:
197 # find a unique @ suffix
197 198 for x in range(1, 100):
198 199 n = '%s@%d' % (k, x)
199 200 if n not in repo._bookmarks:
200 201 break
202 # try to use an @pathalias suffix
203 # if an @pathalias already exists, we overwrite (update) it
204 for p, u in ui.configitems("paths"):
205 if path == u:
206 n = '%s@%s' % (k, p)
207
201 208 repo._bookmarks[n] = cr.node()
202 209 changed = True
203 210 ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n))
@@ -4273,7 +4273,7 def pull(ui, repo, source="default", **o
4273 4273 raise util.Abort(err)
4274 4274
4275 4275 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
4276 bookmarks.updatefromremote(ui, repo, other)
4276 bookmarks.updatefromremote(ui, repo, other, source)
4277 4277 if checkout:
4278 4278 checkout = str(repo.changelog.rev(other.lookup(checkout)))
4279 4279 repo._subtoppath = source
@@ -484,7 +484,8 class hgsubrepo(abstractsubrepo):
484 484 self._repo.ui.status(_('pulling subrepo %s from %s\n')
485 485 % (subrelpath(self), srcurl))
486 486 self._repo.pull(other)
487 bookmarks.updatefromremote(self._repo.ui, self._repo, other)
487 bookmarks.updatefromremote(self._repo.ui, self._repo, other,
488 srcurl)
488 489
489 490 def get(self, state, overwrite=False):
490 491 self._get(state)
@@ -110,18 +110,18 divergent bookmarks
110 110 foo -1:000000000000
111 111 foobar -1:000000000000
112 112
113 $ hg pull ../a
114 pulling from ../a
113 $ hg pull --config paths.foo=../a foo
114 pulling from $TESTTMP/a
115 115 searching for changes
116 116 adding changesets
117 117 adding manifests
118 118 adding file changes
119 119 added 1 changesets with 1 changes to 1 files (+1 heads)
120 divergent bookmark X stored as X@1
120 divergent bookmark X stored as X@foo
121 121 (run 'hg heads' to see heads, 'hg merge' to merge)
122 122 $ hg book
123 123 * X 1:9b140be10808
124 X@1 2:0d2164f0ce0d
124 X@foo 2:0d2164f0ce0d
125 125 Y 0:4e3505fd9583
126 126 foo -1:000000000000
127 127 foobar -1:000000000000
General Comments 0
You need to be logged in to leave comments. Login now