##// END OF EJS Templates
shelve: copy bookmarks and restore them after a commit...
David Soria Parra -
r19874:5836edcb default
parent child Browse files
Show More
@@ -172,11 +172,12 b' def createcmd(ui, repo, pats, opts):'
172
172
173 name = opts['name']
173 name = opts['name']
174
174
175 wlock = lock = tr = None
175 wlock = lock = tr = bms = None
176 try:
176 try:
177 wlock = repo.wlock()
177 wlock = repo.wlock()
178 lock = repo.lock()
178 lock = repo.lock()
179
179
180 bms = repo._bookmarks.copy()
180 # use an uncommited transaction to generate the bundle to avoid
181 # use an uncommited transaction to generate the bundle to avoid
181 # pull races. ensure we don't print the abort message to stderr.
182 # pull races. ensure we don't print the abort message to stderr.
182 tr = repo.transaction('commit', report=lambda x: None)
183 tr = repo.transaction('commit', report=lambda x: None)
@@ -224,11 +225,16 b' def createcmd(ui, repo, pats, opts):'
224 fp=shelvedfile(repo, name, 'patch').opener('wb'),
225 fp=shelvedfile(repo, name, 'patch').opener('wb'),
225 opts=mdiff.diffopts(git=True))
226 opts=mdiff.diffopts(git=True))
226
227
228
227 if ui.formatted():
229 if ui.formatted():
228 desc = util.ellipsis(desc, ui.termwidth())
230 desc = util.ellipsis(desc, ui.termwidth())
229 ui.status(_('shelved as %s\n') % name)
231 ui.status(_('shelved as %s\n') % name)
230 hg.update(repo, parent.node())
232 hg.update(repo, parent.node())
231 finally:
233 finally:
234 if bms:
235 # restore old bookmarks
236 repo._bookmarks.update(bms)
237 repo._bookmarks.write()
232 if tr:
238 if tr:
233 tr.abort()
239 tr.abort()
234 lockmod.release(lock, wlock)
240 lockmod.release(lock, wlock)
@@ -418,3 +418,23 b' test keep and cleanup'
418 default (*) create conflict (glob)
418 default (*) create conflict (glob)
419 $ hg shelve --cleanup
419 $ hg shelve --cleanup
420 $ hg shelve --list
420 $ hg shelve --list
421
422 test bookmarks
423
424 $ hg bookmark test
425 $ hg bookmark
426 * test 5:01ba9745dc5a
427 $ hg shelve
428 shelved as test
429 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
430 $ hg bookmark
431 * test 5:01ba9745dc5a
432 $ hg unshelve
433 unshelving change 'test'
434 adding changesets
435 adding manifests
436 adding file changes
437 added 1 changesets with 1 changes to 7 files
438 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
439 $ hg bookmark
440 * test 5:01ba9745dc5a
General Comments 0
You need to be logged in to leave comments. Login now