diff tests/test-hgweb-diffs.t @ 21122:50981ce36236

hgweb: show as same parents as "hg parents -r REV FILE" in pages for file Before this patch, "parents" in pages for file doesn't show as same parents as "hg parents -r REV FILE", when the specified file is not modified in the specified revision. For example, it is assumed that revision A, B and D change file "f". changelog (A) ---> (B) ---> (C) ---> (D) filelog "f" (x) ---> (y) ------------> (z) "/file/D/f" invokes "webutil.parents()" with filectx(z) gotten from changectx(D), and it returns changectx(B). This is as same result as "hg parents -r D f". In the other hand, "/file/C/f" invokes "webutil.parents()" with filectx(y') gotten from changectx(C), and it returns changectx(A), because filectx(y') is linked to changectx(B), and works like filectx(y) in some cases. In this case, revision B is hidden from users browsing file "f" in revision C. This patch shows as same parents as "hg parents -r REV FILE" in pages for file, by making "webutil.parents()" return: - "linkrev()"-ed revision only, if: - specified context instance is "filectx" (because "webutil.parents()" is invoked with changectx, too), and - (1) the revision from which filectx is gotten and (2) the one to which filectx is linked are different from each other - revision gotten from "ctx.parents()", otherwise
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 17 Apr 2014 09:36:08 +0900
parents 8c9e84b44221
children 92fab48dfec1
line wrap: on
line diff
--- a/tests/test-hgweb-diffs.t	Thu Apr 17 09:36:08 2014 +0900
+++ b/tests/test-hgweb-diffs.t	Thu Apr 17 09:36:08 2014 +0900
@@ -193,6 +193,14 @@
 
 diff removed file
 
+  $ hg log --template "{file_mods}\n{file_dels}\n" -r tip
+  a
+  b
+  $ hg parents --template "{node|short}\n" -r tip
+  0cd96de13884
+  $ hg parents --template "{node|short}\n" -r tip b
+  0cd96de13884
+
   $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'diff/tip/b'
   200 Script output follows
   
@@ -459,7 +467,15 @@
   +b
   
 
-diff removed file
+diff modified file
+
+  $ hg log --template "{file_mods}\n{file_dels}\n" -r tip
+  a
+  b
+  $ hg parents --template "{node|short}\n" -r tip
+  0cd96de13884
+  $ hg parents --template "{node|short}\n" -r tip a
+  0cd96de13884
 
   $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'diff/tip/a'
   200 Script output follows
@@ -531,7 +547,7 @@
   </tr>
   <tr>
    <th>parents</th>
-   <td></td>
+   <td><a href="/file/0cd96de13884/a">0cd96de13884</a> </td>
   </tr>
   <tr>
    <th>children</th>
@@ -934,6 +950,10 @@
   $ hg tip --template "{node|short}\n"
   41d9fc4a6ae1
   $ hg diff -c tip e
+  $ hg parents --template "{node|short}\n" -r tip
+  402bea3b0976
+  $ hg parents --template "{node|short}\n" -r tip e
+  402bea3b0976
 
   $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/e'
   200 Script output follows
@@ -1005,7 +1025,7 @@
   </tr>
   <tr>
    <th>parents</th>
-   <td></td>
+   <td><a href="/file/402bea3b0976/e">402bea3b0976</a> </td>
   </tr>
   <tr>
    <th>children</th>