Commits

Shrikant Sharat Kandula committed f709994

Added "force clone" option to force cloning instead of pulling

Comments (0)

Files changed (2)

 And this will cause the pathogen plugin to be cloned to `bundle/super-plugin` instead of
 `bundle/vim-pathogen`.
 
+If, for some reason, you don't want to pull/fetch, but clone every time instead, you can
+add `force clone` to the end of the bundle line. This is useful, if you are messing up
+the plugin's directory using the commands in `Run` directives, described below.
+
 And of course, you can have a line with both the `with` and the `to` options, along with
 any other that might be added in the future ;).
 
             dest_dir = dest_dir[:-(1 + len(vcs))]
         self.dest_dir = dest_dir
 
+        # Check if requesting force clone
+        self.force_clone = ' force clone' in arg
+        if self.force_clone:
+            sh.rmtree(self.dest_dir)
+
+        # Detect if any subdirectory contains the vim plugin
+        subdir_match = re.search(r'only\s+"(.+?)"', arg)
+        self.subdir = subdir_match.group(1) if subdir_match else None
+
         if vcs is not None:
             print ('!' if self.is_bang else '-') * 20, self.dest_dir
             getattr(self, '_vcs_' + vcs)()
 
     def _vcs_hg(self):
         self.cmds.insert(0, 'hg ' + ('pull' if os.path.exists(self.dest_dir) else 'clone ' + self.url))
+        #self.cmds += ['mv "' + self.subdir + '" /tmp/_vimpire_tmp', 'rm ]
         self._run_cmds()
 
     def _vcs_git(self):