Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/branchmap.py (10 lines) |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 | ||
| Closed | durin42 |
| bin, | bin, | ||||
| hex, | hex, | ||||
| nullid, | nullid, | ||||
| nullrev, | nullrev, | ||||
| ) | ) | ||||
| from . import ( | from . import ( | ||||
| encoding, | encoding, | ||||
| error, | error, | ||||
| pycompat, | |||||
| scmutil, | scmutil, | ||||
| util, | util, | ||||
| ) | ) | ||||
| calcsize = struct.calcsize | calcsize = struct.calcsize | ||||
| pack_into = struct.pack_into | pack_into = struct.pack_into | ||||
| unpack_from = struct.unpack_from | unpack_from = struct.unpack_from | ||||
| last, lrev = bin(last), int(lrev) | last, lrev = bin(last), int(lrev) | ||||
| filteredhash = None | filteredhash = None | ||||
| if len(cachekey) > 2: | if len(cachekey) > 2: | ||||
| filteredhash = bin(cachekey[2]) | filteredhash = bin(cachekey[2]) | ||||
| partial = branchcache(tipnode=last, tiprev=lrev, | partial = branchcache(tipnode=last, tiprev=lrev, | ||||
| filteredhash=filteredhash) | filteredhash=filteredhash) | ||||
| if not partial.validfor(repo): | if not partial.validfor(repo): | ||||
| # invalidate the cache | # invalidate the cache | ||||
| raise ValueError('tip differs') | raise ValueError(r'tip differs') | ||||
| cl = repo.changelog | cl = repo.changelog | ||||
| for l in lines: | for l in lines: | ||||
| if not l: | if not l: | ||||
| continue | continue | ||||
| node, state, label = l.split(" ", 2) | node, state, label = l.split(" ", 2) | ||||
| if state not in 'oc': | if state not in 'oc': | ||||
| raise ValueError('invalid branch state') | raise ValueError(r'invalid branch state') | ||||
| label = encoding.tolocal(label.strip()) | label = encoding.tolocal(label.strip()) | ||||
| node = bin(node) | node = bin(node) | ||||
| if not cl.hasnode(node): | if not cl.hasnode(node): | ||||
| raise ValueError('node %s does not exist' % hex(node)) | raise ValueError( | ||||
| r'node %s does not exist' % pycompat.sysstr(hex(node))) | |||||
| partial.setdefault(label, []).append(node) | partial.setdefault(label, []).append(node) | ||||
| if state == 'c': | if state == 'c': | ||||
| partial._closednodes.add(node) | partial._closednodes.add(node) | ||||
| except Exception as inst: | except Exception as inst: | ||||
| if repo.ui.debugflag: | if repo.ui.debugflag: | ||||
| msg = 'invalid branchheads cache' | msg = 'invalid branchheads cache' | ||||
| if repo.filtername is not None: | if repo.filtername is not None: | ||||
| msg += ' (%s)' % repo.filtername | msg += ' (%s)' % repo.filtername | ||||
| msg += ': %s\n' | msg += ': %s\n' | ||||
| repo.ui.debug(msg % inst) | repo.ui.debug(msg % pycompat.bytestr(inst)) | ||||
| partial = None | partial = None | ||||
| return partial | return partial | ||||
| ### Nearest subset relation | ### Nearest subset relation | ||||
| # Nearest subset of filter X is a filter Y so that: | # Nearest subset of filter X is a filter Y so that: | ||||
| # * Y is included in X, | # * Y is included in X, | ||||
| # * X - Y is as small as possible. | # * X - Y is as small as possible. | ||||
| # This create and ordering used for branchmap purpose. | # This create and ordering used for branchmap purpose. | ||||