Commit 2a1f6e09 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Project.put_hgrc: allow to write on secondary files

parent e86d56bf10d1
...@@ -755,15 +755,20 @@ class Project(object): ...@@ -755,15 +755,20 @@ class Project(object):
'hgrc.managed' if managed else 'hgrc')) 'hgrc.managed' if managed else 'hgrc'))
return self.heptapod.get_file_lines(hgrc_path) return self.heptapod.get_file_lines(hgrc_path)
def put_hgrc(self, lines): def put_hgrc(self, lines, file_path='hgrc'):
"""Replace repo's server-side HGRC with given lines. """Replace repo's server-side HGRC with given lines.
The lines have to include LF, same as with `writelines()`. The lines have to include LF, same as with `writelines()`.
:param str file_path: relative path from the `.hg` directory of the
repo for the file to rewrite. Allows to work on a different file
than the main HGRC. Useful to manage secondary files (inclusions,
clonebundles, configexpress…)
""" """
repo_inner_path = '/'.join((self.fs_path, '.hg')) repo_inner_path = '/'.join((self.fs_path, '.hg'))
return self.heptapod.put_file_lines( return self.heptapod.put_file_lines(
os.path.join(repo_inner_path, 'hgrc'), lines) os.path.join(repo_inner_path, file_path), lines)
def extend_hgrc(self, *lines): def extend_hgrc(self, *lines):
"""Append given lines to repo's server-side HGRC """Append given lines to repo's server-side HGRC
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment