Switch to side-by-side view

--- a/ForgeHg/forgehg/model/hg.py
+++ b/ForgeHg/forgehg/model/hg.py
@@ -70,26 +70,28 @@
 
     def clone_from(self, source_url):
         '''Initialize a repo as a clone of another'''
-        fullname = self._setup_paths(create_repo_dir=False)
-        if os.path.exists(fullname):
-            shutil.rmtree(fullname)
+        self._repo.status = 'cloning'
+        session(self._repo).flush(self._repo)
         log.info('Initialize %r as a clone of %s',
                  self._repo, source_url)
-        # !$ hg doesn't like unicode as urls
-        src, repo = hg.clone(
-            ui.ui(),
-            source_url.encode('utf-8'),
-            self._repo.full_fs_path.encode('utf-8'),
-            update=False)
-        self.__dict__['_hg'] = repo
-        self._setup_special_files()
-        self._repo.status = 'analyzing'
-        session(self._repo).flush()
-        log.info('... %r cloned, analyzing', self._repo)
+        try:
+            fullname = self._setup_paths(create_repo_dir=False)
+            if os.path.exists(fullname):
+                shutil.rmtree(fullname)
+            # !$ hg doesn't like unicode as urls
+            src, repo = hg.clone(
+                ui.ui(),
+                source_url.encode('utf-8'),
+                self._repo.full_fs_path.encode('utf-8'),
+                update=False)
+            self.__dict__['_hg'] = repo
+            self._setup_special_files()
+        except:
+            self._repo.status = 'raise'
+            session(self._repo).flush(self._repo)
+            raise
+        log.info('... %r cloned', self._repo)
         self._repo.refresh(notify=False)
-        self._repo.status = 'ready'
-        log.info('... %s ready', self._repo)
-        session(self._repo).flush()
 
     def commit(self, rev):
         '''Return a Commit object.  rev can be _id or a branch/tag name'''