Commits

theoden committed 848621d

* simple workaround for extracting exclusion patterns from .hgignore at vcs.none
so vcs.none is fixed, but solution wants to be more solid.

Comments (0)

Files changed (1)

fab_deploy/vcs/none.py

 import tempfile
 from datetime import datetime
 
-from fabric.api import run, local, env, put, cd
+from fabric.api import run, local, env, put, cd, warn
 from taskset import TaskSet, task_method
 
 from fab_deploy import utils
 class PseudoVcs(TaskSet):
     BRANCH_OPTION = None
 
+    def _extract_from_hgignore(self):
+        """ Extracts list of exclusion patterns from .hgignore file. """
+        excluded = []
+        try:
+            for str in open('.hgignore'):
+                str = str.strip()
+                if str.startswith(('#', 'syntax: glob')) or str=='':
+                    continue
+                elif str=='syntax: regexp':
+                    raise NotImplementedError('Regexp syntax is not supported.')
+                else:
+                    if str.startswith('*'):
+                        excluded.append(str)
+                    else:
+                        excluded.append(utils._project_path(str))
+        except IOError as e:
+           warn('.hgignore file was not found. Nothing is excluded.')
+        return excluded
+
     def _exclude_string(self):
-        #FIXME! LOCAL_CONFIG does not exist anymore
-        excludes = [utils._project_path('config.py'), '*.pyc', '*.pyo']
+        excludes = self._extract_from_hgignore()
         exclude_string = " ".join(['--exclude="%s"' % pattern for pattern in excludes])
         if os.path.exists('.excludes'):
             exclude_string =  "-X .excludes " + exclude_string