Mercurial > hg-stable
comparison mercurial/hgweb/webcommands.py @ 21121:8c9e84b44221
hgweb: make "comparison" get parent from not filelog but changelog
Before this patch, "comparison" shows unexpected result, when the
specified file is not modified in the specified revision, even though
"diff" shows empty result.
When REV doesn't change specified FILE, "diff" shows:
"hg diff -c REV FILE"
but "comparison" shows:
"hg diff -c `hg parents -r REV FILE` FILE"
In other words, the former gets parent from changelog, but the latter
gets one from filelog.
This may confuse users browsing (and switching "diff" and
"comparison" of) files in the specified revision.
This patch makes "comparison" get parent from not filelog but
changelog, to show "hg diff -c REV FILE" in both "diff" and
"comparison" pages.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 17 Apr 2014 09:36:08 +0900 |
parents | 46f93b7660b6 |
children | 92fab48dfec1 |
comparison
equal
deleted
inserted
replaced
21120:9ea9e94c7492 | 21121:8c9e84b44221 |
---|---|
715 if path in ctx: | 715 if path in ctx: |
716 fctx = ctx[path] | 716 fctx = ctx[path] |
717 rightrev = fctx.filerev() | 717 rightrev = fctx.filerev() |
718 rightnode = fctx.filenode() | 718 rightnode = fctx.filenode() |
719 rightlines = filelines(fctx) | 719 rightlines = filelines(fctx) |
720 parents = fctx.parents() | 720 parent = ctx.p1() |
721 if not parents: | 721 if path not in parent: |
722 leftrev = -1 | 722 leftrev = -1 |
723 leftnode = nullid | 723 leftnode = nullid |
724 leftlines = () | 724 leftlines = () |
725 else: | 725 else: |
726 pfctx = parents[0] | 726 pfctx = parent[path] |
727 leftrev = pfctx.filerev() | 727 leftrev = pfctx.filerev() |
728 leftnode = pfctx.filenode() | 728 leftnode = pfctx.filenode() |
729 leftlines = filelines(pfctx) | 729 leftlines = filelines(pfctx) |
730 else: | 730 else: |
731 rightrev = -1 | 731 rightrev = -1 |