Show More
@@ -48,6 +48,10 b' filecache = scmutil.filecache' | |||||
48 | dirstatetuple = parsers.dirstatetuple |
|
48 | dirstatetuple = parsers.dirstatetuple | |
49 |
|
49 | |||
50 |
|
50 | |||
|
51 | # a special value used internally for `size` if the file come from the other parent | |||
|
52 | FROM_P2 = -2 | |||
|
53 | ||||
|
54 | ||||
51 | class repocache(filecache): |
|
55 | class repocache(filecache): | |
52 | """filecache for files in .hg/""" |
|
56 | """filecache for files in .hg/""" | |
53 |
|
57 | |||
@@ -371,7 +375,7 b' class dirstate(object):' | |||||
371 | copies[f] = source |
|
375 | copies[f] = source | |
372 | self.normallookup(f) |
|
376 | self.normallookup(f) | |
373 | # Also fix up otherparent markers |
|
377 | # Also fix up otherparent markers | |
374 |
elif s[0] == b'n' and s[2] == |
|
378 | elif s[0] == b'n' and s[2] == FROM_P2: | |
375 | source = self._map.copymap.get(f) |
|
379 | source = self._map.copymap.get(f) | |
376 | if source: |
|
380 | if source: | |
377 | copies[f] = source |
|
381 | copies[f] = source | |
@@ -484,16 +488,16 b' class dirstate(object):' | |||||
484 | # being removed, restore that state. |
|
488 | # being removed, restore that state. | |
485 | entry = self._map.get(f) |
|
489 | entry = self._map.get(f) | |
486 | if entry is not None: |
|
490 | if entry is not None: | |
487 |
if entry[0] == b'r' and entry[2] in (-1, |
|
491 | if entry[0] == b'r' and entry[2] in (-1, FROM_P2): | |
488 | source = self._map.copymap.get(f) |
|
492 | source = self._map.copymap.get(f) | |
489 | if entry[2] == -1: |
|
493 | if entry[2] == -1: | |
490 | self.merge(f) |
|
494 | self.merge(f) | |
491 |
elif entry[2] == |
|
495 | elif entry[2] == FROM_P2: | |
492 | self.otherparent(f) |
|
496 | self.otherparent(f) | |
493 | if source: |
|
497 | if source: | |
494 | self.copy(source, f) |
|
498 | self.copy(source, f) | |
495 | return |
|
499 | return | |
496 |
if entry[0] == b'm' or entry[0] == b'n' and entry[2] == |
|
500 | if entry[0] == b'm' or entry[0] == b'n' and entry[2] == FROM_P2: | |
497 | return |
|
501 | return | |
498 | self._addpath(f, b'n', 0, -1, -1) |
|
502 | self._addpath(f, b'n', 0, -1, -1) | |
499 | self._map.copymap.pop(f, None) |
|
503 | self._map.copymap.pop(f, None) | |
@@ -505,10 +509,10 b' class dirstate(object):' | |||||
505 | raise error.Abort(msg) |
|
509 | raise error.Abort(msg) | |
506 | if f in self and self[f] == b'n': |
|
510 | if f in self and self[f] == b'n': | |
507 | # merge-like |
|
511 | # merge-like | |
508 |
self._addpath(f, b'm', 0, |
|
512 | self._addpath(f, b'm', 0, FROM_P2, -1) | |
509 | else: |
|
513 | else: | |
510 | # add-like |
|
514 | # add-like | |
511 |
self._addpath(f, b'n', 0, |
|
515 | self._addpath(f, b'n', 0, FROM_P2, -1) | |
512 | self._map.copymap.pop(f, None) |
|
516 | self._map.copymap.pop(f, None) | |
513 |
|
517 | |||
514 | def add(self, f): |
|
518 | def add(self, f): | |
@@ -527,8 +531,8 b' class dirstate(object):' | |||||
527 | # backup the previous state |
|
531 | # backup the previous state | |
528 | if entry[0] == b'm': # merge |
|
532 | if entry[0] == b'm': # merge | |
529 | size = -1 |
|
533 | size = -1 | |
530 |
elif entry[0] == b'n' and entry[2] == |
|
534 | elif entry[0] == b'n' and entry[2] == FROM_P2: # other parent | |
531 |
size = |
|
535 | size = FROM_P2 | |
532 | self._map.otherparentset.add(f) |
|
536 | self._map.otherparentset.add(f) | |
533 | self._updatedfiles.add(f) |
|
537 | self._updatedfiles.add(f) | |
534 | self._map.removefile(f, oldstate, size) |
|
538 | self._map.removefile(f, oldstate, size) | |
@@ -1302,7 +1306,7 b' class dirstate(object):' | |||||
1302 | (size != st.st_size and size != st.st_size & _rangemask) |
|
1306 | (size != st.st_size and size != st.st_size & _rangemask) | |
1303 | or ((mode ^ st.st_mode) & 0o100 and checkexec) |
|
1307 | or ((mode ^ st.st_mode) & 0o100 and checkexec) | |
1304 | ) |
|
1308 | ) | |
1305 |
or size == |
|
1309 | or size == FROM_P2 # other parent | |
1306 | or fn in copymap |
|
1310 | or fn in copymap | |
1307 | ): |
|
1311 | ): | |
1308 | if stat.S_ISLNK(st.st_mode) and size != st.st_size: |
|
1312 | if stat.S_ISLNK(st.st_mode) and size != st.st_size: | |
@@ -1532,7 +1536,7 b' class dirstatemap(object):' | |||||
1532 | self._map[f] = dirstatetuple(state, mode, size, mtime) |
|
1536 | self._map[f] = dirstatetuple(state, mode, size, mtime) | |
1533 | if state != b'n' or mtime == -1: |
|
1537 | if state != b'n' or mtime == -1: | |
1534 | self.nonnormalset.add(f) |
|
1538 | self.nonnormalset.add(f) | |
1535 |
if size == |
|
1539 | if size == FROM_P2: | |
1536 | self.otherparentset.add(f) |
|
1540 | self.otherparentset.add(f) | |
1537 |
|
1541 | |||
1538 | def removefile(self, f, oldstate, size): |
|
1542 | def removefile(self, f, oldstate, size): | |
@@ -1587,7 +1591,7 b' class dirstatemap(object):' | |||||
1587 | for fname, e in pycompat.iteritems(self._map): |
|
1591 | for fname, e in pycompat.iteritems(self._map): | |
1588 | if e[0] != b'n' or e[3] == -1: |
|
1592 | if e[0] != b'n' or e[3] == -1: | |
1589 | nonnorm.add(fname) |
|
1593 | nonnorm.add(fname) | |
1590 |
if e[0] == b'n' and e[2] == |
|
1594 | if e[0] == b'n' and e[2] == FROM_P2: | |
1591 | otherparent.add(fname) |
|
1595 | otherparent.add(fname) | |
1592 | return nonnorm, otherparent |
|
1596 | return nonnorm, otherparent | |
1593 |
|
1597 |
General Comments 0
You need to be logged in to leave comments.
Login now