1700 self._dirstatevalidatewarned = True |
1699 self._dirstatevalidatewarned = True |
1701 self.ui.warn( |
1700 self.ui.warn( |
1702 _(b"warning: ignoring unknown working parent %s!\n") |
1701 _(b"warning: ignoring unknown working parent %s!\n") |
1703 % short(node) |
1702 % short(node) |
1704 ) |
1703 ) |
1705 return nullid |
1704 return self.nullid |
1706 |
1705 |
1707 @storecache(narrowspec.FILENAME) |
1706 @storecache(narrowspec.FILENAME) |
1708 def narrowpats(self): |
1707 def narrowpats(self): |
1709 """matcher patterns for this repository's narrowspec |
1708 """matcher patterns for this repository's narrowspec |
1710 |
1709 |
1751 self.invalidate(clearfilecache=True) |
1750 self.invalidate(clearfilecache=True) |
1752 |
1751 |
1753 @unfilteredpropertycache |
1752 @unfilteredpropertycache |
1754 def _quick_access_changeid_null(self): |
1753 def _quick_access_changeid_null(self): |
1755 return { |
1754 return { |
1756 b'null': (nullrev, nullid), |
1755 b'null': (nullrev, self.nodeconstants.nullid), |
1757 nullrev: (nullrev, nullid), |
1756 nullrev: (nullrev, self.nodeconstants.nullid), |
1758 nullid: (nullrev, nullid), |
1757 self.nullid: (nullrev, self.nullid), |
1759 } |
1758 } |
1760 |
1759 |
1761 @unfilteredpropertycache |
1760 @unfilteredpropertycache |
1762 def _quick_access_changeid_wc(self): |
1761 def _quick_access_changeid_wc(self): |
1763 # also fast path access to the working copy parents |
1762 # also fast path access to the working copy parents |
1764 # however, only do it for filter that ensure wc is visible. |
1763 # however, only do it for filter that ensure wc is visible. |
1765 quick = self._quick_access_changeid_null.copy() |
1764 quick = self._quick_access_changeid_null.copy() |
1766 cl = self.unfiltered().changelog |
1765 cl = self.unfiltered().changelog |
1767 for node in self.dirstate.parents(): |
1766 for node in self.dirstate.parents(): |
1768 if node == nullid: |
1767 if node == self.nullid: |
1769 continue |
1768 continue |
1770 rev = cl.index.get_rev(node) |
1769 rev = cl.index.get_rev(node) |
1771 if rev is None: |
1770 if rev is None: |
1772 # unknown working copy parent case: |
1771 # unknown working copy parent case: |
1773 # |
1772 # |
2035 # the tags module always uses UTF-8 (in order not to lose info |
2034 # the tags module always uses UTF-8 (in order not to lose info |
2036 # writing to the cache), but the rest of Mercurial wants them in |
2035 # writing to the cache), but the rest of Mercurial wants them in |
2037 # local encoding. |
2036 # local encoding. |
2038 tags = {} |
2037 tags = {} |
2039 for (name, (node, hist)) in pycompat.iteritems(alltags): |
2038 for (name, (node, hist)) in pycompat.iteritems(alltags): |
2040 if node != nullid: |
2039 if node != self.nullid: |
2041 tags[encoding.tolocal(name)] = node |
2040 tags[encoding.tolocal(name)] = node |
2042 tags[b'tip'] = self.changelog.tip() |
2041 tags[b'tip'] = self.changelog.tip() |
2043 tagtypes = { |
2042 tagtypes = { |
2044 encoding.tolocal(name): value |
2043 encoding.tolocal(name): value |
2045 for (name, value) in pycompat.iteritems(tagtypes) |
2044 for (name, value) in pycompat.iteritems(tagtypes) |
2159 return None |
2158 return None |
2160 |
2159 |
2161 def wjoin(self, f, *insidef): |
2160 def wjoin(self, f, *insidef): |
2162 return self.vfs.reljoin(self.root, f, *insidef) |
2161 return self.vfs.reljoin(self.root, f, *insidef) |
2163 |
2162 |
2164 def setparents(self, p1, p2=nullid): |
2163 def setparents(self, p1, p2=None): |
|
2164 if p2 is None: |
|
2165 p2 = self.nullid |
2165 self[None].setparents(p1, p2) |
2166 self[None].setparents(p1, p2) |
2166 self._quick_access_changeid_invalidate() |
2167 self._quick_access_changeid_invalidate() |
2167 |
2168 |
2168 def filectx(self, path, changeid=None, fileid=None, changectx=None): |
2169 def filectx(self, path, changeid=None, fileid=None, changectx=None): |
2169 """changeid must be a changeset revision, if specified. |
2170 """changeid must be a changeset revision, if specified. |
3092 sr = sub.commit(cctx._text, user, date) |
3093 sr = sub.commit(cctx._text, user, date) |
3093 newstate[s] = (newstate[s][0], sr) |
3094 newstate[s] = (newstate[s][0], sr) |
3094 subrepoutil.writestate(self, newstate) |
3095 subrepoutil.writestate(self, newstate) |
3095 |
3096 |
3096 p1, p2 = self.dirstate.parents() |
3097 p1, p2 = self.dirstate.parents() |
3097 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or b'') |
3098 hookp1, hookp2 = hex(p1), (p2 != self.nullid and hex(p2) or b'') |
3098 try: |
3099 try: |
3099 self.hook( |
3100 self.hook( |
3100 b"precommit", throw=True, parent1=hookp1, parent2=hookp2 |
3101 b"precommit", throw=True, parent1=hookp1, parent2=hookp2 |
3101 ) |
3102 ) |
3102 with self.transaction(b'commit'): |
3103 with self.transaction(b'commit'): |
3278 |
3279 |
3279 for top, bottom in pairs: |
3280 for top, bottom in pairs: |
3280 n, l, i = top, [], 0 |
3281 n, l, i = top, [], 0 |
3281 f = 1 |
3282 f = 1 |
3282 |
3283 |
3283 while n != bottom and n != nullid: |
3284 while n != bottom and n != self.nullid: |
3284 p = self.changelog.parents(n)[0] |
3285 p = self.changelog.parents(n)[0] |
3285 if i == f: |
3286 if i == f: |
3286 l.append(n) |
3287 l.append(n) |
3287 f = f * 2 |
3288 f = f * 2 |
3288 n = p |
3289 n = p |