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