##// END OF EJS Templates
hgweb: show revisions and hashes gotten from changelog in "comparison" page...
FUJIWARA Katsunori -
r21123:92fab48d default
parent child Browse files
Show More
@@ -8,7 +8,7 b''
8 import os, mimetypes, re, cgi, copy
8 import os, mimetypes, re, cgi, copy
9 import webutil
9 import webutil
10 from mercurial import error, encoding, archival, templater, templatefilters
10 from mercurial import error, encoding, archival, templater, templatefilters
11 from mercurial.node import short, hex, nullid
11 from mercurial.node import short, hex
12 from mercurial import util
12 from mercurial import util
13 from common import paritygen, staticfile, get_contact, ErrorResponse
13 from common import paritygen, staticfile, get_contact, ErrorResponse
14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
@@ -712,28 +712,22 b' def comparison(web, req, tmpl):'
712 return [_('(binary file %s, hash: %s)') % (mt, hex(f.filenode()))]
712 return [_('(binary file %s, hash: %s)') % (mt, hex(f.filenode()))]
713 return f.data().splitlines()
713 return f.data().splitlines()
714
714
715 parent = ctx.p1()
716 leftrev = parent.rev()
717 leftnode = parent.node()
718 rightrev = ctx.rev()
719 rightnode = ctx.node()
715 if path in ctx:
720 if path in ctx:
716 fctx = ctx[path]
721 fctx = ctx[path]
717 rightrev = fctx.filerev()
718 rightnode = fctx.filenode()
719 rightlines = filelines(fctx)
722 rightlines = filelines(fctx)
720 parent = ctx.p1()
721 if path not in parent:
723 if path not in parent:
722 leftrev = -1
723 leftnode = nullid
724 leftlines = ()
724 leftlines = ()
725 else:
725 else:
726 pfctx = parent[path]
726 pfctx = parent[path]
727 leftrev = pfctx.filerev()
728 leftnode = pfctx.filenode()
729 leftlines = filelines(pfctx)
727 leftlines = filelines(pfctx)
730 else:
728 else:
731 rightrev = -1
732 rightnode = nullid
733 rightlines = ()
729 rightlines = ()
734 fctx = ctx.parents()[0][path]
730 fctx = ctx.parents()[0][path]
735 leftrev = fctx.filerev()
736 leftnode = fctx.filenode()
737 leftlines = filelines(fctx)
731 leftlines = filelines(fctx)
738
732
739 comparison = webutil.compare(tmpl, context, leftlines, rightlines)
733 comparison = webutil.compare(tmpl, context, leftlines, rightlines)
@@ -576,6 +576,10 b' diff modified file'
576
576
577 comparison new file
577 comparison new file
578
578
579 $ hg parents --template "{rev}:{node|short}\n" -r 0
580 $ hg log --template "{rev}:{node|short}\n" -r 0
581 0:0cd96de13884
582
579 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/0/a'
583 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/0/a'
580 200 Script output follows
584 200 Script output follows
581
585
@@ -667,7 +671,7 b' comparison new file'
667 <thead class="header">
671 <thead class="header">
668 <tr>
672 <tr>
669 <th>-1:000000000000</th>
673 <th>-1:000000000000</th>
670 <th>0:b789fdd96dc2</th>
674 <th>0:0cd96de13884</th>
671 </tr>
675 </tr>
672 </thead>
676 </thead>
673
677
@@ -697,6 +701,12 b' comparison existing file'
697 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
701 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
698 $ echo a >> a
702 $ echo a >> a
699 $ hg ci -mc
703 $ hg ci -mc
704
705 $ hg parents --template "{rev}:{node|short}\n" -r tip
706 1:559edbd9ed20
707 $ hg log --template "{rev}:{node|short}\n" -r tip
708 2:d73db4d812ff
709
700 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/a'
710 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/a'
701 200 Script output follows
711 200 Script output follows
702
712
@@ -787,8 +797,8 b' comparison existing file'
787 <table class="bigtable">
797 <table class="bigtable">
788 <thead class="header">
798 <thead class="header">
789 <tr>
799 <tr>
790 <th>0:b789fdd96dc2</th>
800 <th>1:559edbd9ed20</th>
791 <th>1:a80d06849b33</th>
801 <th>2:d73db4d812ff</th>
792 </tr>
802 </tr>
793 </thead>
803 </thead>
794
804
@@ -820,6 +830,12 b' comparison removed file'
820
830
821 $ hg rm a
831 $ hg rm a
822 $ hg ci -md
832 $ hg ci -md
833
834 $ hg parents --template "{rev}:{node|short}\n" -r tip
835 2:d73db4d812ff
836 $ hg log --template "{rev}:{node|short}\n" -r tip
837 3:20e80271eb7a
838
823 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/a'
839 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/a'
824 200 Script output follows
840 200 Script output follows
825
841
@@ -910,8 +926,8 b' comparison removed file'
910 <table class="bigtable">
926 <table class="bigtable">
911 <thead class="header">
927 <thead class="header">
912 <tr>
928 <tr>
913 <th>1:a80d06849b33</th>
929 <th>2:d73db4d812ff</th>
914 <th>-1:000000000000</th>
930 <th>3:20e80271eb7a</th>
915 </tr>
931 </tr>
916 </thead>
932 </thead>
917
933
@@ -947,13 +963,13 b' comparison not-modified file'
947 $ echo f > f
963 $ echo f > f
948 $ hg add f
964 $ hg add f
949 $ hg ci -m f
965 $ hg ci -m f
950 $ hg tip --template "{node|short}\n"
966 $ hg tip --template "{rev}:{node|short}\n"
951 41d9fc4a6ae1
967 5:41d9fc4a6ae1
952 $ hg diff -c tip e
968 $ hg diff -c tip e
953 $ hg parents --template "{node|short}\n" -r tip
969 $ hg parents --template "{rev}:{node|short}\n" -r tip
954 402bea3b0976
970 4:402bea3b0976
955 $ hg parents --template "{node|short}\n" -r tip e
971 $ hg parents --template "{rev}:{node|short}\n" -r tip e
956 402bea3b0976
972 4:402bea3b0976
957
973
958 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/e'
974 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/e'
959 200 Script output follows
975 200 Script output follows
@@ -1045,8 +1061,8 b' comparison not-modified file'
1045 <table class="bigtable">
1061 <table class="bigtable">
1046 <thead class="header">
1062 <thead class="header">
1047 <tr>
1063 <tr>
1048 <th>0:6b67ccefd5ce</th>
1064 <th>4:402bea3b0976</th>
1049 <th>0:6b67ccefd5ce</th>
1065 <th>5:41d9fc4a6ae1</th>
1050 </tr>
1066 </tr>
1051 </thead>
1067 </thead>
1052
1068
General Comments 0
You need to be logged in to leave comments. Login now