Patchwork hgweb: show current search query in the input field

login
register
mail settings
Submitter Alexander Plavin
Date July 13, 2013, 12:43 a.m.
Message ID <51a3bd5cb25478058471.1373676198@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/1854/
State Accepted
Commit afc23eddc324cf150346cbb0d0673788b6a86b66
Headers show

Comments

Alexander Plavin - July 13, 2013, 12:43 a.m.
# HG changeset patch
# User Alexander Plavin <me@aplavin.ru>
# Date 1373547714 -14400
#      Thu Jul 11 17:01:54 2013 +0400
# Node ID 51a3bd5cb254780584711860691ee72e3012a9fc
# Parent  fab1615db25b28837a9af906566c4d8634f06ff8
hgweb: show current search query in the input field
Augie Fackler - July 16, 2013, 3:23 p.m.
On Sat, Jul 13, 2013 at 04:43:18AM +0400, Alexander Plavin wrote:
> # HG changeset patch
> # User Alexander Plavin <me@aplavin.ru>
> # Date 1373547714 -14400
> #      Thu Jul 11 17:01:54 2013 +0400
> # Node ID 51a3bd5cb254780584711860691ee72e3012a9fc
> # Parent  fab1615db25b28837a9af906566c4d8634f06ff8
> hgweb: show current search query in the input field

I like it. Queued.

>
> diff -r fab1615db25b -r 51a3bd5cb254 mercurial/hgweb/webcommands.py
> --- a/mercurial/hgweb/webcommands.py	Sat Jul 13 02:36:29 2013 +0400
> +++ 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:
> @@ -255,7 +257,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)
> diff -r fab1615db25b -r 51a3bd5cb254 mercurial/templates/paper/search.tmpl
> --- a/mercurial/templates/paper/search.tmpl	Sat Jul 13 02:36:29 2013 +0400
> +++ 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>
> diff -r fab1615db25b -r 51a3bd5cb254 mercurial/templates/paper/shortlog.tmpl
> --- a/mercurial/templates/paper/shortlog.tmpl	Sat Jul 13 02:36:29 2013 +0400
> +++ 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>
> diff -r fab1615db25b -r 51a3bd5cb254 tests/test-hgweb-commands.t
> --- a/tests/test-hgweb-commands.t	Sat Jul 13 02:36:29 2013 +0400
> +++ b/tests/test-hgweb-commands.t	Thu Jul 11 17:01:54 2013 +0400
> @@ -257,7 +257,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>
> @@ -495,7 +495,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>
> diff -r fab1615db25b -r 51a3bd5cb254 tests/test-hgweb-empty.t
> --- a/tests/test-hgweb-empty.t	Sat Jul 13 02:36:29 2013 +0400
> +++ 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>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r fab1615db25b -r 51a3bd5cb254 mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Sat Jul 13 02:36:29 2013 +0400
+++ 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:
@@ -255,7 +257,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)
diff -r fab1615db25b -r 51a3bd5cb254 mercurial/templates/paper/search.tmpl
--- a/mercurial/templates/paper/search.tmpl	Sat Jul 13 02:36:29 2013 +0400
+++ 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>
diff -r fab1615db25b -r 51a3bd5cb254 mercurial/templates/paper/shortlog.tmpl
--- a/mercurial/templates/paper/shortlog.tmpl	Sat Jul 13 02:36:29 2013 +0400
+++ 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>
diff -r fab1615db25b -r 51a3bd5cb254 tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t	Sat Jul 13 02:36:29 2013 +0400
+++ b/tests/test-hgweb-commands.t	Thu Jul 11 17:01:54 2013 +0400
@@ -257,7 +257,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>
@@ -495,7 +495,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>
diff -r fab1615db25b -r 51a3bd5cb254 tests/test-hgweb-empty.t
--- a/tests/test-hgweb-empty.t	Sat Jul 13 02:36:29 2013 +0400
+++ 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>