equal
deleted
inserted
replaced
135 |
135 |
136 def __iter__(self): |
136 def __iter__(self): |
137 return iter(self._refmap) |
137 return iter(self._refmap) |
138 |
138 |
139 def iteritems(self): |
139 def iteritems(self): |
140 return pycompat.iteritems(self._refmap) |
140 return self._refmap.items() |
141 |
141 |
142 def items(self): |
142 def items(self): |
143 return self._refmap.items() |
143 return self._refmap.items() |
144 |
144 |
145 # TODO: maybe rename to allnames()? |
145 # TODO: maybe rename to allnames()? |
248 else: |
248 else: |
249 self._repo.vfs.tryunlink(b'bookmarks.current') |
249 self._repo.vfs.tryunlink(b'bookmarks.current') |
250 self._aclean = True |
250 self._aclean = True |
251 |
251 |
252 def _write(self, fp): |
252 def _write(self, fp): |
253 for name, node in sorted(pycompat.iteritems(self._refmap)): |
253 for name, node in sorted(self._refmap.items()): |
254 fp.write(b"%s %s\n" % (hex(node), encoding.fromlocal(name))) |
254 fp.write(b"%s %s\n" % (hex(node), encoding.fromlocal(name))) |
255 self._clean = True |
255 self._clean = True |
256 self._repo.invalidatevolatilesets() |
256 self._repo.invalidatevolatilesets() |
257 |
257 |
258 def expandname(self, bname): |
258 def expandname(self, bname): |
416 raise ValueError( |
416 raise ValueError( |
417 b'headsforactive() only makes sense with an active bookmark' |
417 b'headsforactive() only makes sense with an active bookmark' |
418 ) |
418 ) |
419 name = repo._activebookmark.split(b'@', 1)[0] |
419 name = repo._activebookmark.split(b'@', 1)[0] |
420 heads = [] |
420 heads = [] |
421 for mark, n in pycompat.iteritems(repo._bookmarks): |
421 for mark, n in repo._bookmarks.items(): |
422 if mark.split(b'@', 1)[0] == name: |
422 if mark.split(b'@', 1)[0] == name: |
423 heads.append(n) |
423 heads.append(n) |
424 return heads |
424 return heads |
425 |
425 |
426 |
426 |
474 # We may try to list bookmarks on a repo type that does not |
474 # We may try to list bookmarks on a repo type that does not |
475 # support it (e.g., statichttprepository). |
475 # support it (e.g., statichttprepository). |
476 marks = getattr(repo, '_bookmarks', {}) |
476 marks = getattr(repo, '_bookmarks', {}) |
477 |
477 |
478 hasnode = repo.changelog.hasnode |
478 hasnode = repo.changelog.hasnode |
479 for k, v in pycompat.iteritems(marks): |
479 for k, v in marks.items(): |
480 # don't expose local divergent bookmarks |
480 # don't expose local divergent bookmarks |
481 if hasnode(v) and not isdivergent(k): |
481 if hasnode(v) and not isdivergent(k): |
482 yield k, v |
482 yield k, v |
483 |
483 |
484 |
484 |
685 def mirroring_remote(ui, repo, remotemarks): |
685 def mirroring_remote(ui, repo, remotemarks): |
686 """computes the bookmark changes that set the local bookmarks to |
686 """computes the bookmark changes that set the local bookmarks to |
687 remotemarks""" |
687 remotemarks""" |
688 changed = [] |
688 changed = [] |
689 localmarks = repo._bookmarks |
689 localmarks = repo._bookmarks |
690 for (b, id) in pycompat.iteritems(remotemarks): |
690 for (b, id) in remotemarks.items(): |
691 if id != localmarks.get(b, None) and id in repo: |
691 if id != localmarks.get(b, None) and id in repo: |
692 changed.append((b, id, ui.debug, _(b"updating bookmark %s\n") % b)) |
692 changed.append((b, id, ui.debug, _(b"updating bookmark %s\n") % b)) |
693 for b in localmarks: |
693 for b in localmarks: |
694 if b not in remotemarks: |
694 if b not in remotemarks: |
695 changed.append( |
695 changed.append( |
1072 prepend or postpend names) |
1072 prepend or postpend names) |
1073 """ |
1073 """ |
1074 hexfn = fm.hexfunc |
1074 hexfn = fm.hexfunc |
1075 if len(bmarks) == 0 and fm.isplain(): |
1075 if len(bmarks) == 0 and fm.isplain(): |
1076 ui.status(_(b"no bookmarks set\n")) |
1076 ui.status(_(b"no bookmarks set\n")) |
1077 for bmark, (n, prefix, label) in sorted(pycompat.iteritems(bmarks)): |
1077 for bmark, (n, prefix, label) in sorted(bmarks.items()): |
1078 fm.startitem() |
1078 fm.startitem() |
1079 fm.context(repo=repo) |
1079 fm.context(repo=repo) |
1080 if not ui.quiet: |
1080 if not ui.quiet: |
1081 fm.plain(b' %s ' % prefix, label=label) |
1081 fm.plain(b' %s ' % prefix, label=label) |
1082 fm.write(b'bookmark', b'%s', bmark, label=label) |
1082 fm.write(b'bookmark', b'%s', bmark, label=label) |