if noexclude:
extra_exclude = base_exclude = []
- lines = _output_lines(['git-ls-files', '--others'] + base_exclude
- + extra_exclude)
+ lines = _output_lines(['git-ls-files', '--others', '--directory']
+ + base_exclude + extra_exclude)
cache_files += [('?', line.strip()) for line in lines]
# conflicted files
return result.rstrip()
+def pretty_commit(commit_id = 'HEAD'):
+ """Return a given commit (log + diff)
+ """
+ return _output(['git-diff-tree', '--cc', '--always', '--pretty', '-r',
+ commit_id])
+
def checkout(files = None, tree_id = None, force = False):
"""Check out the given or all files
"""
__set_head(tree_id)
-def reset(files = None, tree_id = None):
+def reset(files = None, tree_id = None, check_out = True):
"""Revert the tree changes relative to the given tree_id. It removes
any local changes
"""
if not tree_id:
tree_id = get_head()
- checkout(files, tree_id, True)
+ if check_out:
+ checkout(files, tree_id, True)
# if the reset refers to the whole tree, switch the HEAD as well
if not files:
def pull(repository = 'origin', refspec = None):
"""Pull changes from the remote repository. At the moment, just
- use the 'git pull' command
+ use the 'git-pull' command
"""
- # 'git pull' updates the HEAD
+ # 'git-pull' updates the HEAD
__clear_head_cache()
args = [repository]
if refspec:
args.append(refspec)
- if __run('git pull', args) != 0:
- raise GitException, 'Failed "git pull %s"' % repository
+ if __run('git-pull', args) != 0:
+ raise GitException, 'Failed "git-pull %s"' % repository
def apply_patch(filename = None, base = None):
"""Apply a patch onto the current or given index. There must not
def clone(repository, local_dir):
"""Clone a remote repository. At the moment, just use the
- 'git clone' script
+ 'git-clone' script
"""
- if __run('git clone', [repository, local_dir]) != 0:
- raise GitException, 'Failed "git clone %s %s"' \
+ if __run('git-clone', [repository, local_dir]) != 0:
+ raise GitException, 'Failed "git-clone %s %s"' \
% (repository, local_dir)
def modifying_revs(files, base_rev):