From b2097570eae01c0b6709e82b5a62d3cb65a43e61 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Fri, 11 Jun 2010 14:57:40 +0200 Subject: [PATCH] fixes for git and svn repositories --- module-tools.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/module-tools.py b/module-tools.py index 246aab3f..fe6d2272 100755 --- a/module-tools.py +++ b/module-tools.py @@ -133,6 +133,7 @@ class SvnRepository: @classmethod def checkout(cls, remote, path, options): + Command("rm -rf %s" % path, options).run_silent() Command("svn co %s %s" % (remote, path), options).run_fatal() return SvnRepository(path, options) @@ -144,7 +145,10 @@ class SvnRepository: Command("svn up %s" % self.path, self.options).run_fatal() def commit(self, logfile): - Command("svn commmit -F %s %s" % (logfile, self.path), self.options).run_fatal() + # add all new files to the repository + Command("svn status %s | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\\ /g' | xargs svn add" % + self.path, self.options).run_silent() + Command("svn commit -F %s %s" % (logfile, self.path), self.options).run_fatal() def revert(self): Command("svn revert %s -R" % self.path, self.options).run_fatal() @@ -167,6 +171,7 @@ class GitRepository: @classmethod def checkout(cls, remote, path, options, depth=1): + Command("rm -rf %s" % path, options).run_silent() Command("git clone --depth %d %s %s" % (depth, remote, path), options).run_fatal() return GitRepository(path, options) @@ -189,11 +194,13 @@ class GitRepository: return self.__run_command_in_repo("git pull") def commit(self, logfile): - self.__run_command_in_repo("git commit -F %s" % logfile) + self.__run_command_in_repo("git add -A") + self.__run_command_in_repo("git commit -F %s" % logfile) self.__run_command_in_repo("git push") def revert(self): - return self.__run_command_in_repo("git --no-pager reset --hard") + self.__run_command_in_repo("git --no-pager reset --hard") + self.__run_command_in_repo("git --no-pager clean -f") def is_clean(self): def check_commit(): -- 2.43.0