This uses "git-config --remove-section", which was first released in
git 1.5.1-rc1. I'm not sure if this is later than what we used to
depend on; we already use "git-config --rename-section", but that's
been in since git 1.5.0-rc0.
Signed-off-by: Karl Hasselström <kha@treskal.com>
).returns([0, 1]).run()
self.__cache.clear()
).returns([0, 1]).run()
self.__cache.clear()
+ def remove_section(self, name):
+ """Remove a section in the config file. Silently do nothing if
+ the section doesn't exist."""
+ Run('git-repo-config', '--remove-section', name
+ ).returns([0, 1]).discard_stderr().discard_output()
+ self.__cache.clear()
+
def set(self, name, value):
Run('git-repo-config', name, value).run()
self.__cache[name] = value
def set(self, name, value):
Run('git-repo-config', name, value).run()
self.__cache[name] = value
except GitException:
out.warn('Could not delete branch "%s"' % self.get_name())
except GitException:
out.warn('Could not delete branch "%s"' % self.get_name())
- # Cleanup parent informations
- # FIXME: should one day make use of git-config --section-remove,
- # scheduled for 1.5.1
- config.unset('branch.%s.remote' % self.get_name())
- config.unset('branch.%s.merge' % self.get_name())
- config.unset('branch.%s.stgit.parentbranch' % self.get_name())
- config.unset(self.format_version_key())
+ config.remove_section('branch.%s' % self.get_name())
+ config.remove_section('branch.%s.stgit' % self.get_name())
def refresh_patch(self, files = None, message = None, edit = False,
show_patch = False,
def refresh_patch(self, files = None, message = None, edit = False,
show_patch = False,