changeset 19396:afc23eddc324

hgweb: show current search query in the input field
author Alexander Plavin <me@aplavin.ru>
date Thu, 11 Jul 2013 17:01:54 +0400
parents 19622224559b
children 42fc6c7c4ad5
files mercurial/hgweb/webcommands.py mercurial/templates/paper/search.tmpl mercurial/templates/paper/shortlog.tmpl tests/test-hgweb-commands.t tests/test-hgweb-empty.t
diffstat 5 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Sun Jul 14 17:23:07 2013 +0200
+++ b/mercurial/hgweb/webcommands.py	Thu Jul 11 17:01:54 2013 +0400
@@ -185,11 +185,13 @@
 
 def changelog(web, req, tmpl, shortlog=False):
 
+    query = ''
     if 'node' in req.form:
         ctx = webutil.changectx(web.repo, req)
     else:
         if 'rev' in req.form:
-            hi = req.form['rev'][0]
+            query = req.form['rev'][0]
+            hi = query
         else:
             hi = 'tip'
         try:
@@ -256,7 +258,7 @@
                 entries=lambda **x: changelist(latestonly=False, **x),
                 latestentry=lambda **x: changelist(latestonly=True, **x),
                 archives=web.archivelist("tip"), revcount=revcount,
-                morevars=morevars, lessvars=lessvars)
+                morevars=morevars, lessvars=lessvars, query=query)
 
 def shortlog(web, req, tmpl):
     return changelog(web, req, tmpl, shortlog = True)
--- a/mercurial/templates/paper/search.tmpl	Sun Jul 14 17:23:07 2013 +0200
+++ b/mercurial/templates/paper/search.tmpl	Thu Jul 11 17:01:54 2013 +0400
@@ -25,7 +25,7 @@
 
 <form class="search" action="{url|urlescape}log">
 {sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
+<p><input name="rev" id="search1" type="text" size="30" value="{query|escape}"></p>
 <div id="hint">find changesets by author, revision,
 files, or words in the commit message</div>
 </form>
--- a/mercurial/templates/paper/shortlog.tmpl	Sun Jul 14 17:23:07 2013 +0200
+++ b/mercurial/templates/paper/shortlog.tmpl	Thu Jul 11 17:01:54 2013 +0400
@@ -44,7 +44,7 @@
 
 <form class="search" action="{url|urlescape}log">
 {sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30" /></p>
+<p><input name="rev" id="search1" type="text" size="30" value="{query|escape}" /></p>
 <div id="hint">find changesets by author, revision,
 files, or words in the commit message</div>
 </form>
--- a/tests/test-hgweb-commands.t	Sun Jul 14 17:23:07 2013 +0200
+++ b/tests/test-hgweb-commands.t	Thu Jul 11 17:01:54 2013 +0400
@@ -289,7 +289,7 @@
   
   <form class="search" action="/log">
   
-  <p><input name="rev" id="search1" type="text" size="30" /></p>
+  <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
   <div id="hint">find changesets by author, revision,
   files, or words in the commit message</div>
   </form>
@@ -525,7 +525,7 @@
   
   <form class="search" action="/log">
   
-  <p><input name="rev" id="search1" type="text" size="30"></p>
+  <p><input name="rev" id="search1" type="text" size="30" value="base"></p>
   <div id="hint">find changesets by author, revision,
   files, or words in the commit message</div>
   </form>
--- a/tests/test-hgweb-empty.t	Sun Jul 14 17:23:07 2013 +0200
+++ b/tests/test-hgweb-empty.t	Thu Jul 11 17:01:54 2013 +0400
@@ -62,7 +62,7 @@
   
   <form class="search" action="/log">
   
-  <p><input name="rev" id="search1" type="text" size="30" /></p>
+  <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
   <div id="hint">find changesets by author, revision,
   files, or words in the commit message</div>
   </form>
@@ -155,7 +155,7 @@
   
   <form class="search" action="/log">
   
-  <p><input name="rev" id="search1" type="text" size="30" /></p>
+  <p><input name="rev" id="search1" type="text" size="30" value="" /></p>
   <div id="hint">find changesets by author, revision,
   files, or words in the commit message</div>
   </form>