From c7a5860d04043698e1182457a889e5a88b5fe09c Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Tue, 8 Mar 2011 10:50:58 +0000
Subject: [PATCH] Increase BT revision according to upstream revision, if
 possible

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44045 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 5 ++++-
 product/ERP5VCS/WorkingCopy.py            | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 4f53c57a79..2873730826 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -4567,7 +4567,10 @@ Business Template is a set of definitions, such as skins, portal types and categ
       # Make sure that everything is sane.
       self.clean()
 
-      self.updateRevisionNumber()
+      try:
+        self.setRevision(self.getVcsTool().newRevision())
+      except NotAWorkingCopyError:
+        self.updateRevisionNumber()
       self._setTemplateFormatVersion(1)
       self.storeTemplateItemData()
 
diff --git a/product/ERP5VCS/WorkingCopy.py b/product/ERP5VCS/WorkingCopy.py
index f997f05617..1b95be7f73 100644
--- a/product/ERP5VCS/WorkingCopy.py
+++ b/product/ERP5VCS/WorkingCopy.py
@@ -200,6 +200,7 @@ class WorkingCopy(Implicit):
       file.write(str(revision))
     finally:
       file.close()
+    return revision
 
   def getLastChangelog(self):
     """Return last changelog of a business template
-- 
2.30.9