comparison mercurial/commands.py @ 26286:4b685712fa45

bookmark: do not crash when active bookmark is forward and --date is used The logic that decides where to update according to the active bookmark location (when not on ".") was setting the rev to update to before we process --date. This lead to --date processing aborting because of duplicated specification. We reorder the two pieces of code and add a test for this.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 17 Sep 2015 16:08:10 -0700
parents 69da16b366ad
children 5ba3358ebc7f
comparison
equal deleted inserted replaced
26285:91cad8eb7951 26286:4b685712fa45
6478 6478
6479 wlock = repo.wlock() 6479 wlock = repo.wlock()
6480 try: 6480 try:
6481 cmdutil.clearunfinished(repo) 6481 cmdutil.clearunfinished(repo)
6482 6482
6483 # with no argument, we also move the active bookmark, if any
6484 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev)
6485
6486 # if we defined a bookmark, we have to remember the original name
6487 brev = rev
6488 rev = scmutil.revsingle(repo, rev, rev).rev()
6489
6490 if check and clean:
6491 raise util.Abort(_("cannot specify both -c/--check and -C/--clean"))
6492
6493 if date: 6483 if date:
6494 if rev is not None: 6484 if rev is not None:
6495 raise util.Abort(_("you can't specify a revision and a date")) 6485 raise util.Abort(_("you can't specify a revision and a date"))
6496 rev = cmdutil.finddate(ui, repo, date) 6486 rev = cmdutil.finddate(ui, repo, date)
6487
6488 # with no argument, we also move the active bookmark, if any
6489 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev)
6490
6491 # if we defined a bookmark, we have to remember the original name
6492 brev = rev
6493 rev = scmutil.revsingle(repo, rev, rev).rev()
6494
6495 if check and clean:
6496 raise util.Abort(_("cannot specify both -c/--check and -C/--clean"))
6497 6497
6498 if check: 6498 if check:
6499 cmdutil.bailifchanged(repo, merge=False) 6499 cmdutil.bailifchanged(repo, merge=False)
6500 if rev is None: 6500 if rev is None:
6501 rev = repo[repo[None].branch()].rev() 6501 rev = repo[repo[None].branch()].rev()