1039 hexfn = fm.hexfunc |
1039 hexfn = fm.hexfunc |
1040 marks = repo._bookmarks |
1040 marks = repo._bookmarks |
1041 if len(marks) == 0 and not fm: |
1041 if len(marks) == 0 and not fm: |
1042 ui.status(_("no bookmarks set\n")) |
1042 ui.status(_("no bookmarks set\n")) |
1043 for bmark, n in sorted(marks.iteritems()): |
1043 for bmark, n in sorted(marks.iteritems()): |
1044 current = repo._activebookmark |
1044 active = repo._activebookmark |
1045 if bmark == current: |
1045 if bmark == active: |
1046 prefix, label = '*', activebookmarklabel |
1046 prefix, label = '*', activebookmarklabel |
1047 else: |
1047 else: |
1048 prefix, label = ' ', '' |
1048 prefix, label = ' ', '' |
1049 |
1049 |
1050 fm.startitem() |
1050 fm.startitem() |
1052 fm.plain(' %s ' % prefix, label=label) |
1052 fm.plain(' %s ' % prefix, label=label) |
1053 fm.write('bookmark', '%s', bmark, label=label) |
1053 fm.write('bookmark', '%s', bmark, label=label) |
1054 pad = " " * (25 - encoding.colwidth(bmark)) |
1054 pad = " " * (25 - encoding.colwidth(bmark)) |
1055 fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s', |
1055 fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s', |
1056 repo.changelog.rev(n), hexfn(n), label=label) |
1056 repo.changelog.rev(n), hexfn(n), label=label) |
1057 fm.data(active=(bmark == current)) |
1057 fm.data(active=(bmark == active)) |
1058 fm.plain('\n') |
1058 fm.plain('\n') |
1059 fm.end() |
1059 fm.end() |
1060 |
1060 |
1061 @command('branch', |
1061 @command('branch', |
1062 [('f', 'force', None, |
1062 [('f', 'force', None, |
1521 opts.get('user') or old.user(), |
1521 opts.get('user') or old.user(), |
1522 opts.get('date') or old.date(), |
1522 opts.get('date') or old.date(), |
1523 match, |
1523 match, |
1524 extra=extra) |
1524 extra=extra) |
1525 |
1525 |
1526 current = repo._activebookmark |
1526 active = repo._activebookmark |
1527 marks = old.bookmarks() |
1527 marks = old.bookmarks() |
1528 node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) |
1528 node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) |
1529 if node == old.node(): |
1529 if node == old.node(): |
1530 ui.status(_("nothing changed\n")) |
1530 ui.status(_("nothing changed\n")) |
1531 return 1 |
1531 return 1 |
1533 ui.debug('moving bookmarks %r from %s to %s\n' % |
1533 ui.debug('moving bookmarks %r from %s to %s\n' % |
1534 (marks, old.hex(), hex(node))) |
1534 (marks, old.hex(), hex(node))) |
1535 newmarks = repo._bookmarks |
1535 newmarks = repo._bookmarks |
1536 for bm in marks: |
1536 for bm in marks: |
1537 newmarks[bm] = node |
1537 newmarks[bm] = node |
1538 if bm == current: |
1538 if bm == active: |
1539 bookmarks.activate(repo, bm) |
1539 bookmarks.activate(repo, bm) |
1540 newmarks.write() |
1540 newmarks.write() |
1541 else: |
1541 else: |
1542 def commitfunc(ui, repo, message, match, opts): |
1542 def commitfunc(ui, repo, message, match, opts): |
1543 backup = ui.backupconfig('phases', 'new-commit') |
1543 backup = ui.backupconfig('phases', 'new-commit') |
5931 ui.write(m, label='log.branch') |
5931 ui.write(m, label='log.branch') |
5932 else: |
5932 else: |
5933 ui.status(m, label='log.branch') |
5933 ui.status(m, label='log.branch') |
5934 |
5934 |
5935 if marks: |
5935 if marks: |
5936 current = repo._activebookmark |
5936 active = repo._activebookmark |
5937 # i18n: column positioning for "hg summary" |
5937 # i18n: column positioning for "hg summary" |
5938 ui.write(_('bookmarks:'), label='log.bookmark') |
5938 ui.write(_('bookmarks:'), label='log.bookmark') |
5939 if current is not None: |
5939 if active is not None: |
5940 if current in marks: |
5940 if active in marks: |
5941 ui.write(' *' + current, label=activebookmarklabel) |
5941 ui.write(' *' + active, label=activebookmarklabel) |
5942 marks.remove(current) |
5942 marks.remove(active) |
5943 else: |
5943 else: |
5944 ui.write(' [%s]' % current, label=activebookmarklabel) |
5944 ui.write(' [%s]' % active, label=activebookmarklabel) |
5945 for m in marks: |
5945 for m in marks: |
5946 ui.write(' ' + m, label='log.bookmark') |
5946 ui.write(' ' + m, label='log.bookmark') |
5947 ui.write('\n', label='log.bookmark') |
5947 ui.write('\n', label='log.bookmark') |
5948 |
5948 |
5949 status = repo.status(unknown=True) |
5949 status = repo.status(unknown=True) |
6359 tool=None): |
6359 tool=None): |
6360 """update working directory (or switch revisions) |
6360 """update working directory (or switch revisions) |
6361 |
6361 |
6362 Update the repository's working directory to the specified |
6362 Update the repository's working directory to the specified |
6363 changeset. If no changeset is specified, update to the tip of the |
6363 changeset. If no changeset is specified, update to the tip of the |
6364 current named branch and move the current bookmark (see :hg:`help |
6364 current named branch and move the active bookmark (see :hg:`help |
6365 bookmarks`). |
6365 bookmarks`). |
6366 |
6366 |
6367 Update sets the working directory's parent revision to the specified |
6367 Update sets the working directory's parent revision to the specified |
6368 changeset (see :hg:`help parents`). |
6368 changeset (see :hg:`help parents`). |
6369 |
6369 |
6412 if rev is None or rev == '': |
6412 if rev is None or rev == '': |
6413 rev = node |
6413 rev = node |
6414 |
6414 |
6415 cmdutil.clearunfinished(repo) |
6415 cmdutil.clearunfinished(repo) |
6416 |
6416 |
6417 # with no argument, we also move the current bookmark, if any |
6417 # with no argument, we also move the active bookmark, if any |
6418 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev) |
6418 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev) |
6419 |
6419 |
6420 # if we defined a bookmark, we have to remember the original bookmark name |
6420 # if we defined a bookmark, we have to remember the original bookmark name |
6421 brev = rev |
6421 brev = rev |
6422 rev = scmutil.revsingle(repo, rev, rev).rev() |
6422 rev = scmutil.revsingle(repo, rev, rev).rev() |