hg site extension
 
(Arne Babenhauserheide)
2011-11-24: added -B flag to push all bookmarks.

added -B flag to push all bookmarks.

diff --git a/.bugs/bugs b/.bugs/bugs
--- a/.bugs/bugs
+++ b/.bugs/bugs
@@ -1,10 +1,11 @@
-push all bookmarks too                                                                                                                     | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:0661fcb89dfedcd564bdb2d4865d41b58494ac2e, time:1320547191.52
+push all bookmarks too                                                                                                                     | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:0661fcb89dfedcd564bdb2d4865d41b58494ac2e, time:1320547191.52
 add sourcecode coloring to the src files.                                                                                                  | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:09715a67cfabe2de0901f0472610c2285626e0e7, time:1319147685.11
 Add a list of branches, heads and tags to the summary page.                                                                                | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:0fde104c4206be8245ff0716ee2e91ea3971db8f, time:1319147651.17
 if b is used: a bugtracker: issue/<id>/<name>                                                                                              | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:1d631d51ff06b3bdca50e21da3d6a00bcb801c85, time:1319147632.52
 add css classes and ids everywhere, so this can be styled with CSS.                                                                        | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:2699812cf02c803fa338daf9ae039c43a30a0b5f, time:1322090683.01
 get mtimes from the repo instead of querying the FTP server. We know which files were changed.                                             | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:29210503551d0eafca67dda8d6fffbd40bf837dc, time:1319213074.57
 FIX: revision 0 is omitted: change that :)                                                                                                 | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:29396f1753e45b5a37ffa0ce04d96c876d6b6722, time:1319209563.68
+parse the pushed repo, not the local one.                                                                                                  | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:2c26d62b62e3656ebcce43e7a24f627594911fb5, time:1322115065.37
 only write .statichgrepo print.css style.css and index.html when their data changed \(or \-\-force\) → read them and compare the contents. | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:4f02149269a60fca85aa040116b2789d98c906f2, time:1319212903.98
 add proper caching of every ftp directory listing.                                                                                         | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:750692931106d78ffc38c1ed63013c4dac4099dd, time:1319175393.07
 fork-/clone-info for each entry in [paths] with its incoming data (if it has some):                                                        | owner:, open:True, id:8621575e4016752e8987c8b294dfa9166f77eff3, time:1319147671.39
@@ -17,4 +18,5 @@ commits as commit/<rev>/ for long term v
 clone/<pathname>/ → incoming log (commits) + possibly an associated issue in b.                                                            | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:c58557260a47597ac5057703e26a94df190a2a5d, time:1319147661.8
 no longer create raw files, since they can’t be served by all webservers and waste bandwidth and space (they are no longer linked anyway). | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:d1010e1933648f65af37d969bfb45f8d834fc8bb, time:1319148721.49
 check the hgweb templating for parsing the site.                                                                                           | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:ef17f01dbe8ee58536fa8b345eb18d1efc639f15, time:1319208643.38
+maybe more advanced bookmarks pushing.                                                                                                     | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:ef8c12bfcc99686efc1f685a9be0be0c78922ca5, time:1322115049.48
 Treat branch heads specially: link on the main page.                                                                                       | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:f531c27b38f9ea1749ded312f4f468c9ac33b930, time:1319147696.96
diff --git a/site.py b/site.py
--- a/site.py
+++ b/site.py
@@ -326,7 +326,7 @@ def parsesite(ui, repo, target, **opts):
     writesourcetree(ui, repo, target, name, force=opts["force"])
 
 
-def addrepo(ui, repo, target):
+def addrepo(ui, repo, target, bookmarks):
     """Add the repo to the target and make sure it is up to date."""
     try:
         commands.init(ui, dest=target)
@@ -335,7 +335,10 @@ def addrepo(ui, repo, target):
         pass
 
     ui.pushbuffer()
-    commands.push(ui, repo, dest=target, bookmark=repo._bookmarks)
+    if bookmarks: 
+        commands.push(ui, repo, dest=target, bookmark=repo._bookmarks)
+    else: 
+        commands.push(ui, repo, dest=target)
     ui.popbuffer()
 
 
@@ -447,7 +450,10 @@ def staticsite(ui, repo, target=None, **
     if not target: target = "static"
     #print repo["."].branch()
     # add the hg repo to the static site
-    addrepo(ui, repo, target)
+    # currently we need to either include all bookmarks or not, because we don’t have the remote repo when parsing the site.
+    # TODO: I don’t know if that is the correct way to go. Maybe always push all.
+    bookmarks = opts["bookmarks"]
+    addrepo(ui, repo, target, bookmarks)
     # first: just create the site.
     parsesite(ui, repo, target, **opts)
     if opts["upload"]:
@@ -466,6 +472,7 @@ cmdtable = {
                       ('u', 'upload', "", 'upload the repo to the given ftp host. Format: user:password@host/path/to/dir'),
                       ('f', 'force', False, 'force recreating all commit files. Slow.'),
                       ('s', 'screenstyle', "", 'use a custom stylesheet for display on screen'),
-                      ('p', 'printstyle', "", 'use a custom stylesheet for printing')],
+                      ('p', 'printstyle', "", 'use a custom stylesheet for printing'),
+                      ('B', 'bookmarks', False, 'include the bookmarks')],
                      "[options] [folder]")
 }