Show More
@@ -446,10 +446,11 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 | extra - a dictionary of extra values, or None. | |
|
449 | 450 | changes - a list of file lists as returned by localrepo.status() |
|
450 | 451 | or None to use the repository status. |
|
451 | 452 | """ |
|
452 | def __init__(self, repo, parents=None, changes=None): | |
|
453 | def __init__(self, repo, parents=None, extra=None, changes=None): | |
|
453 | 454 | self._repo = repo |
|
454 | 455 | self._rev = None |
|
455 | 456 | self._node = None |
@@ -459,6 +460,19 class workingctx(changectx): | |||
|
459 | 460 | if changes: |
|
460 | 461 | self._status = list(changes) |
|
461 | 462 | |
|
463 | self._extra = {} | |
|
464 | if extra: | |
|
465 | self._extra = extra.copy() | |
|
466 | if 'branch' not in self._extra: | |
|
467 | branch = self._repo.dirstate.branch() | |
|
468 | try: | |
|
469 | branch = branch.decode('UTF-8').encode('UTF-8') | |
|
470 | except UnicodeDecodeError: | |
|
471 | raise util.Abort(_('branch name not in UTF-8!')) | |
|
472 | self._extra['branch'] = branch | |
|
473 | if self._extra['branch'] == '': | |
|
474 | self._extra['branch'] = 'default' | |
|
475 | ||
|
462 | 476 | def __str__(self): |
|
463 | 477 | return str(self._parents[0]) + "+" |
|
464 | 478 | |
@@ -518,7 +532,8 class workingctx(changectx): | |||
|
518 | 532 | def deleted(self): return self._status[3] |
|
519 | 533 | def unknown(self): return self._status[4] |
|
520 | 534 | def clean(self): return self._status[5] |
|
521 |
def branch(self): return self._ |
|
|
535 | def branch(self): return self._extra['branch'] | |
|
536 | def extra(self): return self._extra | |
|
522 | 537 | |
|
523 | 538 | def tags(self): |
|
524 | 539 | t = [] |
@@ -491,8 +491,8 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, changes=None): | |
|
495 | return context.workingctx(self, parents, changes) | |
|
494 | def workingctx(self, parents=None, extra=None, changes=None): | |
|
495 | return context.workingctx(self, parents, extra, changes) | |
|
496 | 496 | |
|
497 | 497 | def parents(self, changeid=None): |
|
498 | 498 | ''' |
@@ -767,7 +767,6 class localrepository(repo.repository): | |||
|
767 | 767 | remove = [] |
|
768 | 768 | changed = [] |
|
769 | 769 | use_dirstate = (p1 is None) # not rawcommit |
|
770 | extra = extra.copy() | |
|
771 | 770 | |
|
772 | 771 | if use_dirstate: |
|
773 | 772 | p1, p2 = self.dirstate.parents() |
@@ -796,9 +795,11 class localrepository(repo.repository): | |||
|
796 | 795 | update_dirstate = (self.dirstate.parents()[0] == p1) |
|
797 | 796 | changes = [files, [], [], [], []] |
|
798 | 797 | |
|
799 | wctx = self.workingctx((p1, p2), changes) | |
|
798 | wctx = self.workingctx((p1, p2), extra, changes) | |
|
800 | 799 | commit = wctx.modified() + wctx.added() |
|
801 | 800 | remove = wctx.removed() |
|
801 | extra = wctx.extra().copy() | |
|
802 | branchname = extra['branch'] | |
|
802 | 803 | |
|
803 | 804 | c1 = self.changelog.read(p1) |
|
804 | 805 | c2 = self.changelog.read(p2) |
@@ -806,15 +807,6 class localrepository(repo.repository): | |||
|
806 | 807 | m2 = self.manifest.read(c2[0]) |
|
807 | 808 | |
|
808 | 809 | if use_dirstate: |
|
809 | branchname = wctx.branch() | |
|
810 | try: | |
|
811 | branchname = branchname.decode('UTF-8').encode('UTF-8') | |
|
812 | except UnicodeDecodeError: | |
|
813 | raise util.Abort(_('branch name not in UTF-8!')) | |
|
814 | else: | |
|
815 | branchname = "" | |
|
816 | ||
|
817 | if use_dirstate: | |
|
818 | 810 | oldname = c1[5].get("branch") # stored in UTF-8 |
|
819 | 811 | if (not commit and not remove and not force and p2 == nullid |
|
820 | 812 | and branchname == oldname): |
@@ -901,9 +893,6 class localrepository(repo.repository): | |||
|
901 | 893 | text = self.ui.edit("\n".join(edittext), user) |
|
902 | 894 | os.chdir(olddir) |
|
903 | 895 | |
|
904 | if branchname: | |
|
905 | extra["branch"] = branchname | |
|
906 | ||
|
907 | 896 | lines = [line.rstrip() for line in text.rstrip().splitlines()] |
|
908 | 897 | while lines and not lines[0]: |
|
909 | 898 | del lines[0] |
General Comments 0
You need to be logged in to leave comments.
Login now