##// END OF EJS Templates
bundle: update current bookmark to most recent revision on current branch...
David Soria Parra -
r13663:d16c99f1 default
parent child Browse files
Show More
@@ -116,6 +116,15 b' def setcurrent(repo, mark):'
116 wlock.release()
116 wlock.release()
117 repo._bookmarkcurrent = mark
117 repo._bookmarkcurrent = mark
118
118
119 def updatecurrentbookmark(repo, oldnode, curbranch):
120 try:
121 update(repo, oldnode, repo.branchtags()[curbranch])
122 except KeyError:
123 if curbranch == "default": # no default branch!
124 update(repo, oldnode, repo.lookup("tip"))
125 else:
126 raise util.Abort(_("branch %s not found") % curbranch)
127
119 def update(repo, parents, node):
128 def update(repo, parents, node):
120 marks = repo._bookmarks
129 marks = repo._bookmarks
121 update = False
130 update = False
@@ -4038,15 +4038,16 b' def unbundle(ui, repo, fname1, *fnames, '
4038 fnames = (fname1,) + fnames
4038 fnames = (fname1,) + fnames
4039
4039
4040 lock = repo.lock()
4040 lock = repo.lock()
4041 wc = repo['.']
4041 try:
4042 try:
4042 for fname in fnames:
4043 for fname in fnames:
4043 f = url.open(ui, fname)
4044 f = url.open(ui, fname)
4044 gen = changegroup.readbundle(f, fname)
4045 gen = changegroup.readbundle(f, fname)
4045 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname,
4046 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname,
4046 lock=lock)
4047 lock=lock)
4048 bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch())
4047 finally:
4049 finally:
4048 lock.release()
4050 lock.release()
4049
4050 return postincoming(ui, repo, modheads, opts.get('update'), None)
4051 return postincoming(ui, repo, modheads, opts.get('update'), None)
4051
4052
4052 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):
4053 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):
@@ -288,3 +288,36 b' test clone with a specific revision'
288 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
288 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 $ hg -R cloned-bookmarks-rev bookmarks
289 $ hg -R cloned-bookmarks-rev bookmarks
290 X2 1:925d80f479bb
290 X2 1:925d80f479bb
291
292 create bundle with two heads
293
294 $ hg clone . tobundle
295 updating to branch default
296 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
297 $ echo x > tobundle/x
298 $ hg -R tobundle add tobundle/x
299 $ hg -R tobundle commit -m'x'
300 $ hg -R tobundle update -r -2
301 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
302 $ echo y > tobundle/y
303 $ hg -R tobundle branch test
304 marked working directory as branch test
305 $ hg -R tobundle add tobundle/y
306 $ hg -R tobundle commit -m'y'
307 $ hg -R tobundle bundle tobundle.hg
308 searching for changes
309 2 changesets found
310 $ hg unbundle tobundle.hg
311 adding changesets
312 adding manifests
313 adding file changes
314 added 2 changesets with 2 changes to 2 files (+1 heads)
315 (run 'hg heads' to see heads, 'hg merge' to merge)
316 $ hg update
317 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
318 $ hg bookmarks
319 X2 1:925d80f479bb
320 Y 2:db815d6d32e6
321 * Z 3:125c9a1d6df6
322 x y 2:db815d6d32e6
323
General Comments 0
You need to be logged in to leave comments. Login now