Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 39713:a5dafefc4a53
memctx: simplify _manifest with new revlog nodeids
This was originally written before we had modifiednodeid and
addednodeid, so we had to get the parents of the context, the data from
the function, and then hash that.
This is much more simple now and helps refactor more code later.
author | Sean Farley <sean@farley.io> |
---|---|
date | Tue, 22 May 2018 16:16:11 +0200 |
parents | 15e86ecf6b26 |
children | 2327abace563 |
comparison
equal
deleted
inserted
replaced
39712:15e86ecf6b26 | 39713:a5dafefc4a53 |
---|---|
34 patch, | 34 patch, |
35 pathutil, | 35 pathutil, |
36 phases, | 36 phases, |
37 pycompat, | 37 pycompat, |
38 repoview, | 38 repoview, |
39 revlog, | |
40 scmutil, | 39 scmutil, |
41 sparse, | 40 sparse, |
42 subrepo, | 41 subrepo, |
43 subrepoutil, | 42 subrepoutil, |
44 util, | 43 util, |
2285 # keep this simple for now; just worry about p1 | 2284 # keep this simple for now; just worry about p1 |
2286 pctx = self._parents[0] | 2285 pctx = self._parents[0] |
2287 man = pctx.manifest().copy() | 2286 man = pctx.manifest().copy() |
2288 | 2287 |
2289 for f in self._status.modified: | 2288 for f in self._status.modified: |
2290 p1node = nullid | 2289 man[f] = modifiednodeid |
2291 p2node = nullid | |
2292 p = pctx[f].parents() # if file isn't in pctx, check p2? | |
2293 if len(p) > 0: | |
2294 p1node = p[0].filenode() | |
2295 if len(p) > 1: | |
2296 p2node = p[1].filenode() | |
2297 man[f] = revlog.hash(self[f].data(), p1node, p2node) | |
2298 | 2290 |
2299 for f in self._status.added: | 2291 for f in self._status.added: |
2300 man[f] = revlog.hash(self[f].data(), nullid, nullid) | 2292 man[f] = addednodeid |
2301 | 2293 |
2302 for f in self._status.removed: | 2294 for f in self._status.removed: |
2303 if f in man: | 2295 if f in man: |
2304 del man[f] | 2296 del man[f] |
2305 | 2297 |