Show More
@@ -478,6 +478,13 class mergestate(object): | |||
|
478 | 478 | f.write(_pack(format, key, len(data), data)) |
|
479 | 479 | f.close() |
|
480 | 480 | |
|
481 | @staticmethod | |
|
482 | def getlocalkey(path): | |
|
483 | """hash the path of a local file context for storage in the .hg/merge | |
|
484 | directory.""" | |
|
485 | ||
|
486 | return hex(hashlib.sha1(path).digest()) | |
|
487 | ||
|
481 | 488 | def add(self, fcl, fco, fca, fd): |
|
482 | 489 | """add a new (potentially?) conflicting file the merge state |
|
483 | 490 | fcl: file context for local, |
@@ -488,11 +495,11 class mergestate(object): | |||
|
488 | 495 | note: also write the local version to the `.hg/merge` directory. |
|
489 | 496 | """ |
|
490 | 497 | if fcl.isabsent(): |
|
491 |
|
|
|
498 | localkey = nullhex | |
|
492 | 499 | else: |
|
493 | hash = hex(hashlib.sha1(fcl.path()).digest()) | |
|
494 |
self._repo.vfs.write('merge/' + |
|
|
495 |
self._state[fd] = [MERGE_RECORD_UNRESOLVED, |
|
|
500 | localkey = mergestate.getlocalkey(fcl.path()) | |
|
501 | self._repo.vfs.write('merge/' + localkey, fcl.data()) | |
|
502 | self._state[fd] = [MERGE_RECORD_UNRESOLVED, localkey, fcl.path(), | |
|
496 | 503 | fca.path(), hex(fca.filenode()), |
|
497 | 504 | fco.path(), hex(fco.filenode()), |
|
498 | 505 | fcl.flags()] |
@@ -551,7 +558,7 class mergestate(object): | |||
|
551 | 558 | MERGE_RECORD_DRIVER_RESOLVED): |
|
552 | 559 | return True, 0 |
|
553 | 560 | stateentry = self._state[dfile] |
|
554 |
state, |
|
|
561 | state, localkey, lfile, afile, anode, ofile, onode, flags = stateentry | |
|
555 | 562 | octx = self._repo[self._other] |
|
556 | 563 | extras = self.extras(dfile) |
|
557 | 564 | anccommitnode = extras.get('ancestorlinknode') |
@@ -559,7 +566,7 class mergestate(object): | |||
|
559 | 566 | actx = self._repo[anccommitnode] |
|
560 | 567 | else: |
|
561 | 568 | actx = None |
|
562 |
fcd = self._filectxorabsent( |
|
|
569 | fcd = self._filectxorabsent(localkey, wctx, dfile) | |
|
563 | 570 | fco = self._filectxorabsent(onode, octx, ofile) |
|
564 | 571 | # TODO: move this to filectxorabsent |
|
565 | 572 | fca = self._repo.filectx(afile, fileid=anode, changectx=actx) |
@@ -577,8 +584,8 class mergestate(object): | |||
|
577 | 584 | flags = flo |
|
578 | 585 | if preresolve: |
|
579 | 586 | # restore local |
|
580 |
if |
|
|
581 |
f = self._repo.vfs('merge/' + |
|
|
587 | if localkey != nullhex: | |
|
588 | f = self._repo.vfs('merge/' + localkey) | |
|
582 | 589 | wctx[dfile].write(f.read(), flags) |
|
583 | 590 | f.close() |
|
584 | 591 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now