return cache_files
-def local_changes():
+def local_changes(verbose = True):
"""Return true if there are local changes in the tree
"""
- return len(__tree_status(verbose = True)) != 0
+ return len(__tree_status(verbose = verbose)) != 0
# HEAD value cached
__head = None
"""Apply a patch onto the current or given index. There must not
be any local changes in the tree, otherwise the command fails
"""
- if base:
- orig_head = get_head()
- switch(base)
- else:
- refresh_index()
-
if diff is None:
if filename:
f = file(filename)
if filename:
f.close()
+ if base:
+ orig_head = get_head()
+ switch(base)
+ else:
+ refresh_index()
+
try:
_input_str('git-apply --index', diff)
except GitException:
f = file('.stgit-failed.patch', 'w+')
f.write(diff)
f.close()
+ print >> sys.stderr, 'Diff written to the .stgit-failed.patch file'
raise