[damned-lies] Checkout branch before copying file (Fixes bug #723421)



commit 26bc8a03aee2c786d5c91fa4c371797ee7b57119
Author: Claude Paroz <claude 2xlibre net>
Date:   Mon Feb 3 18:05:58 2014 +0100

    Checkout branch before copying file (Fixes bug #723421)

 stats/models.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 557e167..25204f4 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -686,9 +686,6 @@ class Branch(models.Model):
         dest_path = os.path.join(commit_dir, dest_filename)
         already_exist = os.access(dest_path, os.F_OK)
 
-        # Copy file in repo
-        utils.copy_file(po_file, dest_path)
-
         if vcs_type == "git":
             var_dict = {
                 'dest':    commit_dir,
@@ -700,6 +697,10 @@ class Branch(models.Model):
             }
             with ModuleLock(self.module):
                 utils.run_shell_command("cd \"%(dest)s\" && git checkout %(branch)s" % var_dict, 
raise_on_error=True)
+
+                # Copy file in repo
+                utils.copy_file(po_file, dest_path)
+
                 # git add file.po
                 utils.run_shell_command("cd \"%(dest)s\" && git add %(po_file)s" % var_dict, 
raise_on_error=True)
                 if not already_exist:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]