diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -654,10 +654,10 @@ def static(web, req, tmpl):
return [staticfile(static, fname, req)]
def graph(web, req, tmpl):
+
rev = webutil.changectx(web.repo, req).rev()
bg_height = 39
-
- revcount = 25
+ revcount = web.maxshortchanges
if 'revcount' in req.form:
revcount = int(req.form.get('revcount', [revcount])[0])
tmpl.defaults['sessionvars']['revcount'] = revcount
diff --git a/tests/test-hgweb-commands.out b/tests/test-hgweb-commands.out
--- a/tests/test-hgweb-commands.out
+++ b/tests/test-hgweb-commands.out
@@ -660,8 +660,8 @@ graph |
branches |
files
-less
-more
+less
+more
| (0) -2 tip
@@ -746,8 +746,8 @@ graph.render(data);