cmenu: create the .hgignore file when initializing repo
authorTK Soh <teekaysoh@yahoo.com>
Fri, 04 Jul 2008 01:10:43 +0100
changeset 1173 67cb458efa2f
parent 1172 8ff7c4091ee8
child 1174 4b30a3efa4b9
cmenu: create the .hgignore file when initializing repo mainly to workaround Explorer's problem in creating files with name that start with a dot.
tortoise/contextmenu.py
--- a/tortoise/contextmenu.py	Tue Jul 01 09:29:14 2008 +0100
+++ b/tortoise/contextmenu.py	Fri Jul 04 01:10:43 2008 +0100
@@ -520,7 +520,18 @@
         if rv == 2:
             return
         try:
+            # initialize the repo
             hg.repository(ui.ui(), dest, create=1)
+            
+            # create the .hgignore file, mainly to workaround
+            # Explorer's problem in creating files with name
+            # that start with a dot.
+            hgignore = os.path.join(dest, '.hgignore')
+            if not os.path.exists(hgignore):
+                try:
+                    open(hgignore, 'wb')
+                except:
+                    pass
         except:
             msg = "Error creating repo"
             win32ui.MessageBox(msg, title,