p.tochild.write(line)
p.tochild.close()
if p.wait():
- raise GitException, '%s failed (%s)' % (str(cmd),
+ raise GitException, '%s failed (%s)' % (' '.join(cmd),
p.childerr.read().strip())
def _input_str(cmd, string):
p.tochild.write(string)
p.tochild.close()
if p.wait():
- raise GitException, '%s failed (%s)' % (str(cmd),
+ raise GitException, '%s failed (%s)' % (' '.join(cmd),
p.childerr.read().strip())
def _output(cmd):
p=popen2.Popen3(cmd, True)
output = p.fromchild.read()
if p.wait():
- raise GitException, '%s failed (%s)' % (str(cmd),
+ raise GitException, '%s failed (%s)' % (' '.join(cmd),
p.childerr.read().strip())
return output
p.tochild.close()
output = p.fromchild.readline().strip()
if p.wait():
- raise GitException, '%s failed (%s)' % (str(cmd),
+ raise GitException, '%s failed (%s)' % (' '.join(cmd),
p.childerr.read().strip())
return output
p=popen2.Popen3(cmd, True)
lines = p.fromchild.readlines()
if p.wait():
- raise GitException, '%s failed (%s)' % (str(cmd),
+ raise GitException, '%s failed (%s)' % (' '.join(cmd),
p.childerr.read().strip())
return lines
return r
return 0
-def __tree_status(files = None, tree_id = 'HEAD', unknown = False,
+def tree_status(files = None, tree_id = 'HEAD', unknown = False,
noexclude = True, verbose = False, diff_flags = []):
"""Returns a list of pairs - [status, filename]
"""
def local_changes(verbose = True):
"""Return true if there are local changes in the tree
"""
- return len(__tree_status(verbose = verbose)) != 0
+ return len(tree_status(verbose = verbose)) != 0
# HEAD value cached
__head = None
if not files:
files = []
- cache_files = __tree_status(files, verbose = False)
+ cache_files = tree_status(files, verbose = False)
# everything is up-to-date
if len(cache_files) == 0:
if not files:
files = []
- cache_files = __tree_status(files, unknown = True, noexclude = noexclude,
+ cache_files = tree_status(files, unknown = True, noexclude = noexclude,
diff_flags = diff_flags)
all = not (modified or new or deleted or conflict or unknown)
tree_id = get_head()
if check_out:
- cache_files = __tree_status(files, tree_id)
+ cache_files = tree_status(files, tree_id)
# files which were added but need to be removed
rm_files = [x[1] for x in cache_files if x[0] in ['A']]
# here we are sure to have a single fetch_head
return fetch_head
+
+def all_refs():
+ """Return a list of all refs in the current repository.
+ """
+
+ return [line.split()[1] for line in _output_lines(['git-show-ref'])]