[damned-lies] Add method to hard reset a module repository
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Add method to hard reset a module repository
- Date: Tue, 5 Jan 2021 20:53:17 +0000 (UTC)
commit b0e61b1fcfabf884e390eb95cd305aeab0b3ca32
Author: Claude Paroz <claude 2xlibre net>
Date: Sat Nov 21 11:10:57 2020 +0100
Add method to hard reset a module repository
stats/models.py | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/stats/models.py b/stats/models.py
index 9620cae6..9c88e459 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -168,6 +168,16 @@ class Module(models.Model):
return True
return False
+ def reset_hard(self):
+ """Remove all module checkouts and re-create them."""
+ branches = self.get_branches()
+ for branch in branches:
+ path = branch.co_path
+ if path.exists():
+ shutil.rmtree(path)
+ for branch in branches:
+ branch._repo.init_checkout()
+
class ModuleLock:
""" Weird things happen when multiple updates run in parallel for the same module
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]