[eit.commands.branch] make branch switching more atomic

This commit is contained in:
Fabio Erculiani
2011-10-17 09:43:09 +02:00
parent 79e04d55c8
commit 6f9aabc55e

View File

@@ -128,11 +128,15 @@ class EitBranch(EitCommand):
# set branch to new branch first
entropy_server.set_branch(self._to_branch)
status = entropy_server._switch_packages_branch(
repository_id, from_branch, self._to_branch)
if status is None:
entropy_server.set_branch(from_branch)
return 1
status = None
try:
status = entropy_server._switch_packages_branch(
repository_id, from_branch, self._to_branch)
if status is None:
return 1
finally:
if status is None:
entropy_server.set_branch(from_branch)
switched, already_switched, ignored, \
not_found, no_checksum = status