Skip to content

Commit

Permalink
Add -N argument to prevent git doing pulls, speeds up reruns
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewWilkes committed Jan 5, 2013
1 parent a6fb849 commit 08795e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/mr/cabot/git.py
Expand Up @@ -14,6 +14,8 @@
from mr.cabot.interfaces import IGeolocation, IListing, IUserDatabase
from mr.cabot.sebastian import logger

BLOCKED_COMMANDS = set()

def create(url):
return GitRepo(url)

Expand Down Expand Up @@ -66,6 +68,8 @@ def __del__(self):
shutil.rmtree(self._directory)

def _git_command(self, *args):
if args[0] in BLOCKED_COMMANDS:
return
cwd = os.getcwd()
try:
return subprocess.check_output(["git"] + list(args), stderr=subprocess.STDOUT, cwd=self.location)
Expand Down
8 changes: 7 additions & 1 deletion src/mr/cabot/sebastian.py
Expand Up @@ -105,8 +105,9 @@ def __call__(self, **kwargs):
self.parser.add_argument('-v', '--version',
action='version',
version='mr.cabot %s' % version)
self.parser.add_argument('--pickle',
self.parser.add_argument('--pickle',
help="path to the file where old pickled data is stored")
self.parser.add_argument("-N", help="No updates, don't pull any git repos, use the caches", action="store_true")
args = self.parser.parse_args()
try:
self.buildout_dir = find_base()
Expand All @@ -116,6 +117,11 @@ def __call__(self, **kwargs):
logger.error("You are not in a path which has mr.cabot installed (%s)." % e)
return

if args.N:
import git
git.BLOCKED_COMMANDS.add("pull")
git.BLOCKED_COMMANDS.add("fetch")

self.config = SafeConfigParser()
self.config.read(os.path.join(self.buildout_dir, "mr.cabot.cfg"))

Expand Down

0 comments on commit 08795e0

Please sign in to comment.