diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -509,9 +509,9 @@ def bookmark(ui, repo, mark=None, rev=No
if mark is None:
raise util.Abort(_("new bookmark name required"))
marks[mark] = marks[rename]
- del marks[rename]
if repo._bookmarkcurrent == rename:
bookmarks.setcurrent(repo, mark)
+ del marks[rename]
bookmarks.write(repo)
return
diff --git a/mercurial/templates/gitweb/graph.tmpl b/mercurial/templates/gitweb/graph.tmpl
--- a/mercurial/templates/gitweb/graph.tmpl
+++ b/mercurial/templates/gitweb/graph.tmpl
@@ -39,7 +39,7 @@ graph |
diff --git a/mercurial/templates/monoblue/graph.tmpl b/mercurial/templates/monoblue/graph.tmpl
--- a/mercurial/templates/monoblue/graph.tmpl
+++ b/mercurial/templates/monoblue/graph.tmpl
@@ -35,7 +35,7 @@
The revision graph only works with JavaScript-enabled browsers.
diff --git a/mercurial/templates/paper/graph.tmpl b/mercurial/templates/paper/graph.tmpl
--- a/mercurial/templates/paper/graph.tmpl
+++ b/mercurial/templates/paper/graph.tmpl
@@ -51,7 +51,7 @@ files, or words in the commit message
-
+
diff --git a/mercurial/templates/spartan/graph.tmpl b/mercurial/templates/spartan/graph.tmpl
--- a/mercurial/templates/spartan/graph.tmpl
+++ b/mercurial/templates/spartan/graph.tmpl
@@ -32,7 +32,7 @@ navigate: {chang
diff --git a/tests/test-bookmarks-current.t b/tests/test-bookmarks-current.t
--- a/tests/test-bookmarks-current.t
+++ b/tests/test-bookmarks-current.t
@@ -36,6 +36,10 @@ rename
list bookmarks
+ $ cat .hg/bookmarks.current
+ Z (no-eol)
+ $ cat .hg/bookmarks
+ 0000000000000000000000000000000000000000 Z
$ hg bookmarks
* Z -1:000000000000
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -807,7 +807,7 @@ Overviews
diff --git a/tests/test-hgweb-empty.t b/tests/test-hgweb-empty.t
--- a/tests/test-hgweb-empty.t
+++ b/tests/test-hgweb-empty.t
@@ -232,7 +232,7 @@ Some tests for hgweb in an empty reposit