X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/b993aa15c106eadf473fd64edbb9f3d9ddb7754a..dec7209ba6551afa5b885e892bff4f9ff34ef58b:/lib/hg.py?ds=sidebyside diff --git a/lib/hg.py b/lib/hg.py index b8795b71..9e08e516 100644 --- a/lib/hg.py +++ b/lib/hg.py @@ -35,36 +35,31 @@ class Repository(object): return localrepo.localrepository(self.ui, path, create=1) raise RepositoryDoesNotExist("Repository %s does not exist." % path) - def all_files(self, branch='default'): - return self.in_branch(lambda: self._all_files(), branch) + def file_list(self, branch): + return self.in_branch(lambda: self._file_list(), branch) - def _all_files(self): + def _file_list(self): return list(self.repo[None]) - def get_file(self, path, branch='default'): + def get_file(self, path, branch): return self.in_branch(lambda: self._get_file(path), branch) def _get_file(self, path): return self.repo.wread(path) - def add_file(self, path, value, branch='default'): + def add_file(self, path, value, branch): return self.in_branch(lambda: self._add_file(path, value), branch) def _add_file(self, path, value): return self.repo.wwrite(path, value.encode('utf-8'), []) -# f = codecs.open(os.path.join(self.real_path, path), 'w', encoding='utf-8') -# f.write(value) -# f.close() -# if path not in self._pending_files: -# self._pending_files.append(path) def _commit(self, message, user=None): return self.repo.commit(text=message, user=user) - def commit(self, message, user=None, branch='default'): + def commit(self, message, branch, user=None): return self.in_branch(lambda: self._commit(message, key=key, user=user), branch) - def in_branch(self, action, bname='default'): + def in_branch(self, action, bname): wlock = self.repo.wlock() try: old = self._switch_to_branch(bname)