Mercurial > kallithea
changeset 4304:0f4402c519ff
remove: when removing a repo don't rename its .hg/.git folder
There is no need to do that ... and doing it will just make analysis and
recovery harder and confuse other tools recursing the repos, such as hgweb.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 10 Dec 2013 19:30:37 +0100 |
parents | 4b7a790d9702 |
children | 6b97c7e8d03c |
files | kallithea/lib/vcs/utils/helpers.py kallithea/model/repo.py |
diffstat | 2 files changed, 7 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/vcs/utils/helpers.py Fri Jul 18 18:44:54 2014 +0200 +++ b/kallithea/lib/vcs/utils/helpers.py Tue Dec 10 19:30:37 2013 +0100 @@ -75,10 +75,12 @@ result = [] for key in ALIASES: + # find .hg / .git dirname = os.path.join(path, '.' + key) if os.path.isdir(dirname): result.append(key) continue + # find rm__.hg / rm__.git too - left overs from old method for deleting dirname = os.path.join(path, 'rm__.' + key) if os.path.isdir(dirname): return result
--- a/kallithea/model/repo.py Fri Jul 18 18:44:54 2014 +0200 +++ b/kallithea/model/repo.py Tue Dec 10 19:30:37 2013 +0100 @@ -762,26 +762,14 @@ def _delete_filesystem_repo(self, repo): """ - removes repo from filesystem, the removal is acctually made by - added rm__ prefix into dir, and rename internat .hg/.git dirs so this - repository is no longer valid for kallithea, can be undeleted later on - by reverting the renames on this repository + removes repo from filesystem, the removal is actually done by + renaming dir to a 'rm__*' prefix which Kallithea will skip. + It can be undeleted later by reverting the rename. :param repo: repo object """ rm_path = os.path.join(self.repos_path, repo.repo_name) - log.info("Removing repository %s" % (rm_path,)) - # disable hg/git internal that it doesn't get detected as repo - alias = repo.repo_type - - bare = getattr(repo.scm_instance, 'bare', False) - - # skip this for bare git repos - if not bare: - # disable VCS repo - vcs_path = os.path.join(rm_path, '.%s' % alias) - if os.path.exists(vcs_path): - shutil.move(vcs_path, os.path.join(rm_path, 'rm__.%s' % alias)) + log.info("Removing %s" % (rm_path)) _now = datetime.now() _ms = str(_now.microsecond).rjust(6, '0') @@ -790,6 +778,4 @@ if repo.group: args = repo.group.full_path_splitted + [_d] _d = os.path.join(*args) - - if os.path.isdir(rm_path): - shutil.move(rm_path, os.path.join(self.repos_path, _d)) + shutil.move(rm_path, os.path.join(self.repos_path, _d))