equal
deleted
inserted
replaced
13 from .i18n import _ |
13 from .i18n import _ |
14 from .node import ( |
14 from .node import ( |
15 bin, |
15 bin, |
16 hex, |
16 hex, |
17 short, |
17 short, |
18 wdirid, |
|
19 ) |
18 ) |
20 from .pycompat import getattr |
19 from .pycompat import getattr |
21 from . import ( |
20 from . import ( |
22 encoding, |
21 encoding, |
23 error, |
22 error, |
640 wdirid (all bits set) will be used as a special value for "missing" |
639 wdirid (all bits set) will be used as a special value for "missing" |
641 """ |
640 """ |
642 binarydata = [] |
641 binarydata = [] |
643 for book, node in bookmarks: |
642 for book, node in bookmarks: |
644 if not node: # None or '' |
643 if not node: # None or '' |
645 node = wdirid |
644 node = repo.nodeconstants.wdirid |
646 binarydata.append(_binaryentry.pack(node, len(book))) |
645 binarydata.append(_binaryentry.pack(node, len(book))) |
647 binarydata.append(book) |
646 binarydata.append(book) |
648 return b''.join(binarydata) |
647 return b''.join(binarydata) |
649 |
648 |
650 |
649 |
672 node, length = _binaryentry.unpack(entry) |
671 node, length = _binaryentry.unpack(entry) |
673 bookmark = stream.read(length) |
672 bookmark = stream.read(length) |
674 if len(bookmark) < length: |
673 if len(bookmark) < length: |
675 if entry: |
674 if entry: |
676 raise error.Abort(_(b'bad bookmark stream')) |
675 raise error.Abort(_(b'bad bookmark stream')) |
677 if node == wdirid: |
676 if node == repo.nodeconstants.wdirid: |
678 node = None |
677 node = None |
679 books.append((bookmark, node)) |
678 books.append((bookmark, node)) |
680 return books |
679 return books |
681 |
680 |
682 |
681 |