##// END OF EJS Templates
localrepo: Refactor var names in filecommit to improve readability.
Martijn Pieters -
r8244:99d7e2db default
parent child Browse files
Show More
@@ -711,15 +711,15 b' class localrepository(repo.repository):'
711 711 commit an individual file as part of a larger transaction
712 712 """
713 713
714 fn = fctx.path()
715 t = fctx.data()
716 fl = self.file(fn)
717 fp1 = manifest1.get(fn, nullid)
718 fp2 = manifest2.get(fn, nullid)
714 fname = fctx.path()
715 text = fctx.data()
716 flog = self.file(fname)
717 fparent1 = manifest1.get(fname, nullid)
718 fparent2 = manifest2.get(fname, nullid)
719 719
720 720 meta = {}
721 cp = fctx.renamed()
722 if cp and cp[0] != fn:
721 copy = fctx.renamed()
722 if copy and copy[0] != fname:
723 723 # Mark the new revision of this file as a copy of another
724 724 # file. This copy data will effectively act as a parent
725 725 # of this new revision. If this is a merge, the first
@@ -739,43 +739,43 b' class localrepository(repo.repository):'
739 739 # \- 2 --- 4 as the merge base
740 740 #
741 741
742 cf = cp[0]
743 cr = manifest1.get(cf)
744 nfp = fp2
742 cfname = copy[0]
743 crev = manifest1.get(cfname)
744 newfparent = fparent2
745 745
746 746 if manifest2: # branch merge
747 if fp2 == nullid or cr is None: # copied on remote side
748 if cf in manifest2:
749 cr = manifest2[cf]
750 nfp = fp1
747 if fparent2 == nullid or crev is None: # copied on remote side
748 if cfname in manifest2:
749 crev = manifest2[cfname]
750 newfparent = fparent1
751 751
752 752 # find source in nearest ancestor if we've lost track
753 if not cr:
753 if not crev:
754 754 self.ui.debug(_(" %s: searching for copy revision for %s\n") %
755 (fn, cf))
756 for a in self['.'].ancestors():
757 if cf in a:
758 cr = a[cf].filenode()
755 (fname, cfname))
756 for ancestor in self['.'].ancestors():
757 if cfname in ancestor:
758 crev = ancestor[cfname].filenode()
759 759 break
760 760
761 self.ui.debug(_(" %s: copy %s:%s\n") % (fn, cf, hex(cr)))
762 meta["copy"] = cf
763 meta["copyrev"] = hex(cr)
764 fp1, fp2 = nullid, nfp
765 elif fp2 != nullid:
761 self.ui.debug(_(" %s: copy %s:%s\n") % (fname, cfname, hex(crev)))
762 meta["copy"] = cfname
763 meta["copyrev"] = hex(crev)
764 fparent1, fparent2 = nullid, newfparent
765 elif fparent2 != nullid:
766 766 # is one parent an ancestor of the other?
767 fpa = fl.ancestor(fp1, fp2)
768 if fpa == fp1:
769 fp1, fp2 = fp2, nullid
770 elif fpa == fp2:
771 fp2 = nullid
767 fparentancestor = flog.ancestor(fparent1, fparent2)
768 if fparentancestor == fparent1:
769 fparent1, fparent2 = fparent2, nullid
770 elif fparentancestor == fparent2:
771 fparent2 = nullid
772 772
773 773 # is the file unmodified from the parent? report existing entry
774 if fp2 == nullid and not fl.cmp(fp1, t) and not meta:
775 return fp1
774 if fparent2 == nullid and not flog.cmp(fparent1, text) and not meta:
775 return fparent1
776 776
777 changelist.append(fn)
778 return fl.add(t, meta, tr, linkrev, fp1, fp2)
777 changelist.append(fname)
778 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
779 779
780 780 def rawcommit(self, files, text, user, date, p1=None, p2=None, extra={}):
781 781 if p1 is None:
General Comments 0
You need to be logged in to leave comments. Login now