166 yield self.t("difflineat", line=l) |
166 yield self.t("difflineat", line=l) |
167 else: |
167 else: |
168 yield self.t("diffline", line=l) |
168 yield self.t("diffline", line=l) |
169 |
169 |
170 r = self.repo |
170 r = self.repo |
171 cl = r.changelog |
171 c1 = r.changectx(node1) |
172 mf = r.manifest |
172 c2 = r.changectx(node2) |
173 change1 = cl.read(node1) |
173 date1 = util.datestr(c1.date()) |
174 change2 = cl.read(node2) |
174 date2 = util.datestr(c2.date()) |
175 mmap1 = mf.read(change1[0]) |
|
176 mmap2 = mf.read(change2[0]) |
|
177 date1 = util.datestr(change1[2]) |
|
178 date2 = util.datestr(change2[2]) |
|
179 |
175 |
180 modified, added, removed, deleted, unknown = r.status(node1, node2)[:5] |
176 modified, added, removed, deleted, unknown = r.status(node1, node2)[:5] |
181 if files: |
177 if files: |
182 modified, added, removed = map(lambda x: filterfiles(files, x), |
178 modified, added, removed = map(lambda x: filterfiles(files, x), |
183 (modified, added, removed)) |
179 (modified, added, removed)) |
184 |
180 |
185 diffopts = patch.diffopts(self.repo.ui, untrusted=True) |
181 diffopts = patch.diffopts(self.repo.ui, untrusted=True) |
186 for f in modified: |
182 for f in modified: |
187 to = r.file(f).read(mmap1[f]) |
183 to = c1.filectx(f).data() |
188 tn = r.file(f).read(mmap2[f]) |
184 tn = c2.filectx(f).data() |
189 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f, |
185 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f, |
190 opts=diffopts), f, tn) |
186 opts=diffopts), f, tn) |
191 for f in added: |
187 for f in added: |
192 to = None |
188 to = None |
193 tn = r.file(f).read(mmap2[f]) |
189 tn = c2.filectx(f).data() |
194 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f, |
190 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f, |
195 opts=diffopts), f, tn) |
191 opts=diffopts), f, tn) |
196 for f in removed: |
192 for f in removed: |
197 to = r.file(f).read(mmap1[f]) |
193 to = c1.filectx(f).data() |
198 tn = None |
194 tn = None |
199 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f, |
195 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f, |
200 opts=diffopts), f, tn) |
196 opts=diffopts), f, tn) |
201 |
197 |
202 def changelog(self, ctx, shortlog=False): |
198 def changelog(self, ctx, shortlog=False): |
491 fentries=filelist, |
487 fentries=filelist, |
492 dentries=dirlist, |
488 dentries=dirlist, |
493 archives=self.archivelist(hex(node))) |
489 archives=self.archivelist(hex(node))) |
494 |
490 |
495 def tags(self): |
491 def tags(self): |
496 cl = self.repo.changelog |
|
497 |
|
498 i = self.repo.tagslist() |
492 i = self.repo.tagslist() |
499 i.reverse() |
493 i.reverse() |
500 |
494 |
501 def entries(notip=False, **map): |
495 def entries(notip=False, **map): |
502 parity = 0 |
496 parity = 0 |
503 for k, n in i: |
497 for k, n in i: |
504 if notip and k == "tip": |
498 if notip and k == "tip": |
505 continue |
499 continue |
506 yield {"parity": self.stripes(parity), |
500 yield {"parity": self.stripes(parity), |
507 "tag": k, |
501 "tag": k, |
508 "date": cl.read(n)[2], |
502 "date": self.repo.changectx(n).date(), |
509 "node": hex(n)} |
503 "node": hex(n)} |
510 parity += 1 |
504 parity += 1 |
511 |
505 |
512 yield self.t("tags", |
506 yield self.t("tags", |
513 node=hex(self.repo.changelog.tip()), |
507 node=hex(self.repo.changelog.tip()), |
514 entries=lambda **x: entries(False, **x), |
508 entries=lambda **x: entries(False, **x), |
515 entriesnotip=lambda **x: entries(True, **x)) |
509 entriesnotip=lambda **x: entries(True, **x)) |
516 |
510 |
517 def summary(self): |
511 def summary(self): |
518 cl = self.repo.changelog |
|
519 |
|
520 i = self.repo.tagslist() |
512 i = self.repo.tagslist() |
521 i.reverse() |
513 i.reverse() |
522 |
514 |
523 def tagentries(**map): |
515 def tagentries(**map): |
524 parity = 0 |
516 parity = 0 |
558 'date': ctx.date()} |
547 'date': ctx.date()} |
559 parity += 1 |
548 parity += 1 |
560 |
549 |
561 def changelist(**map): |
550 def changelist(**map): |
562 parity = 0 |
551 parity = 0 |
563 cl = self.repo.changelog |
|
564 l = [] # build a list in forward order for efficiency |
552 l = [] # build a list in forward order for efficiency |
565 for i in xrange(start, end): |
553 for i in xrange(start, end): |
566 n = cl.node(i) |
554 ctx = self.repo.changectx(i) |
567 changes = cl.read(n) |
555 hn = hex(ctx.node()) |
568 hn = hex(n) |
|
569 t = changes[2] |
|
570 |
556 |
571 l.insert(0, self.t( |
557 l.insert(0, self.t( |
572 'shortlogentry', |
558 'shortlogentry', |
573 parity = parity, |
559 parity=parity, |
574 author = changes[1], |
560 author=ctx.user(), |
575 desc = changes[4], |
561 desc=ctx.description(), |
576 date = t, |
562 date=ctx.date(), |
577 rev = i, |
563 rev=i, |
578 node = hn)) |
564 node=hn)) |
579 parity = 1 - parity |
565 parity = 1 - parity |
580 |
566 |
581 yield l |
567 yield l |
582 |
568 |
|
569 cl = self.repo.changelog |
583 count = cl.count() |
570 count = cl.count() |
584 start = max(0, count - self.maxchanges) |
571 start = max(0, count - self.maxchanges) |
585 end = min(count, start + self.maxchanges) |
572 end = min(count, start + self.maxchanges) |
586 |
573 |
587 yield self.t("summary", |
574 yield self.t("summary", |
588 desc = self.config("web", "description", "unknown"), |
575 desc=self.config("web", "description", "unknown"), |
589 owner = (self.config("ui", "username") or # preferred |
576 owner=(self.config("ui", "username") or # preferred |
590 self.config("web", "contact") or # deprecated |
577 self.config("web", "contact") or # deprecated |
591 self.config("web", "author", "unknown")), # also |
578 self.config("web", "author", "unknown")), # also |
592 lastchange = cl.read(cl.tip())[2], |
579 lastchange=cl.read(cl.tip())[2], |
593 tags = tagentries, |
580 tags=tagentries, |
594 heads = heads, |
581 heads=heads, |
595 shortlog = changelist, |
582 shortlog=changelist, |
596 node = hex(cl.tip()), |
583 node=hex(cl.tip()), |
597 archives=self.archivelist("tip")) |
584 archives=self.archivelist("tip")) |
598 |
585 |
599 def filediff(self, fctx): |
586 def filediff(self, fctx): |
600 n = fctx.node() |
587 n = fctx.node() |
601 path = fctx.path() |
588 path = fctx.path() |