hg site extension
 
(Arne Babenhauserheide)
2012-02-21: FIX: Failed when creating a new repo with not yet existing

FIX: Failed when creating a new repo with not yet existing stylesheet.

diff --git a/site.py b/site.py
--- a/site.py
+++ b/site.py
@@ -348,14 +348,14 @@ def parsesite(ui, repo, target, **opts):
     screenfile = join(target, "style.css")
     if screenstyle and not samefilecontent(screenstyle, screenfile):
         shutil.copyfile(screenstyle, screenfile)
-    elif not contentequals(screenfile,templates["screenstyle"]):
-        with open(join(target, "style.css"), "w") as f:
+    elif not isfile(screenfile) or not contentequals(screenfile,templates["screenstyle"]):
+        with open(screenfile, "w") as f:
             f.write(templates["screenstyle"])
     printstyle = opts["printstyle"]
     printfile = join(target, "print.css")
     if printstyle and not samefilecontent(printstyle, printfile):
         shutil.copyfile(printstyle, printfile)
-    elif not contentequals(printfile, templates["printstyle"]):
+    elif not isfile(printfile) or not contentequals(printfile, templates["printstyle"]):
         with open(printfile, "w") as f:
             f.write(templates["printstyle"])