+ map(os.remove, rm_files)
+
+def pull(repository = 'origin', refspec = None):
+ """Pull changes from the remote repository. At the moment, just
+ use the 'git pull' command
+ """
+ args = [repository]
+ if refspec:
+ args.append(refspec)
+
+ if __run('git pull', args) != 0:
+ raise GitException, 'Failed "git pull %s"' % repository
+
+def apply_patch(filename = None):
+ """Apply a patch onto the current index. There must not be any
+ local changes in the tree, otherwise the command fails
+ """
+ os.system('git-update-cache --refresh > /dev/null')
+
+ if filename:
+ if __run('git-apply --index', [filename]) != 0:
+ raise GitException, 'Patch does not apply cleanly'
+ else:
+ _input('git-apply --index', sys.stdin)
+
+def clone(repository, local_dir):
+ """Clone a remote repository. At the moment, just use the
+ 'git clone' script
+ """
+ if __run('git clone', [repository, local_dir]) != 0:
+ raise GitException, 'Failed "git clone %s %s"' \
+ % (repository, local_dir)