Show More
@@ -446,14 +446,18 b' class workingctx(changectx):' | |||
|
446 | 446 | """A workingctx object makes access to data related to |
|
447 | 447 | the current working directory convenient. |
|
448 | 448 | parents - a pair of parent nodeids, or None to use the dirstate. |
|
449 | changes - a list of file lists as returned by localrepo.status() | |
|
450 | or None to use the repository status. | |
|
449 | 451 | """ |
|
450 | def __init__(self, repo, parents=None): | |
|
452 | def __init__(self, repo, parents=None, changes=None): | |
|
451 | 453 | self._repo = repo |
|
452 | 454 | self._rev = None |
|
453 | 455 | self._node = None |
|
454 | 456 | if parents: |
|
455 | 457 | p1, p2 = parents |
|
456 | 458 | self._parents = [self._repo.changectx(p) for p in (p1, p2)] |
|
459 | if changes: | |
|
460 | self._status = list(changes) | |
|
457 | 461 | |
|
458 | 462 | def __str__(self): |
|
459 | 463 | return str(self._parents[0]) + "+" |
@@ -491,8 +491,8 b' class localrepository(repo.repository):' | |||
|
491 | 491 | def changectx(self, changeid=None): |
|
492 | 492 | return context.changectx(self, changeid) |
|
493 | 493 | |
|
494 | def workingctx(self, parents=None): | |
|
495 | return context.workingctx(self, parents) | |
|
494 | def workingctx(self, parents=None, changes=None): | |
|
495 | return context.workingctx(self, parents, changes) | |
|
496 | 496 | |
|
497 | 497 | def parents(self, changeid=None): |
|
498 | 498 | ''' |
@@ -777,29 +777,28 b' class localrepository(repo.repository):' | |||
|
777 | 777 | (match and (match.files() or match.anypats()))): |
|
778 | 778 | raise util.Abort(_('cannot partially commit a merge ' |
|
779 | 779 | '(do not specify files or patterns)')) |
|
780 | else: | |
|
781 | p1, p2 = p1, p2 or nullid | |
|
782 | update_dirstate = (self.dirstate.parents()[0] == p1) | |
|
783 | 780 | |
|
784 | wctx = self.workingctx((p1, p2)) | |
|
785 | ||
|
786 | if use_dirstate: | |
|
787 | 781 | if files: |
|
782 | modified, removed = [], [] | |
|
788 | 783 | for f in files: |
|
789 | 784 | s = self.dirstate[f] |
|
790 | 785 | if s in 'nma': |
|
791 |
|
|
|
786 | modified.append(f) | |
|
792 | 787 | elif s == 'r': |
|
793 | remove.append(f) | |
|
788 | removed.append(f) | |
|
794 | 789 | else: |
|
795 | 790 | self.ui.warn(_("%s not tracked!\n") % f) |
|
791 | changes = [modified, [], removed, [], []] | |
|
796 | 792 | else: |
|
797 |
changes = self.status(match=match) |
|
|
798 | modified, added, removed, deleted, unknown = changes | |
|
799 | commit = modified + added | |
|
800 | remove = removed | |
|
793 | changes = self.status(match=match) | |
|
801 | 794 | else: |
|
802 | commit = files | |
|
795 | p1, p2 = p1, p2 or nullid | |
|
796 | update_dirstate = (self.dirstate.parents()[0] == p1) | |
|
797 | changes = [files, [], [], [], []] | |
|
798 | ||
|
799 | wctx = self.workingctx((p1, p2), changes) | |
|
800 | commit = wctx.modified() + wctx.added() | |
|
801 | remove = wctx.removed() | |
|
803 | 802 | |
|
804 | 803 | c1 = self.changelog.read(p1) |
|
805 | 804 | c2 = self.changelog.read(p2) |
General Comments 0
You need to be logged in to leave comments.
Login now