ctrochalakis / tx-submissions (http://transifex.org/)

fork of transifex

GSoC '08: Introducing a new transifex submission system, an api and a command line client
Clone URL : http://bitbucket.org/ctrochalakis/tx-submissions/ (size: 1.4 MB)
commit 440: e84bdb90198a
parent 439: 4fc447f6c232
branch: default
Raise SubmitterErrors in HgSubmitter
Christos Trochalakis / ctrochalakis
5 months ago

Changed (Δ328 bytes):

raw changeset »

transifex/submissions/methods/hg.py (14 lines added, 5 lines removed)

Up to file-list transifex/submissions/methods/hg.py:

@@ -5,7 +5,8 @@ from turbogears import config, identity
5
5
from turbogears import config, identity
6
6
7
7
from transifex.util import get_user_email
8
from transifex.submissions.methods import BrowserMixin, dvcs_submit_msg
8
from transifex.submissions.methods import SubmitterError, BrowserMixin, \
9
                                            dvcs_submit_msg
9
10
10
11
hgrepo_path = os.path.join(config.get('scratchdir'), 'hg')
11
12
@@ -22,7 +23,12 @@ class HgSubmitter(BrowserMixin):
22
23
        try:
23
24
            self.repo = hg.repository(ui.ui(), self.path)
24
25
        except RepoError:
25
            self.init_repo()
26
            # Repo does not exist, create it"
27
            try:
28
                self.init_repo()
29
            except RepoError, e:
30
                # Remote repo error
31
                raise SubmitterError, e
26
32
27
33
    def submit_msg(self, msg):
28
34
        return dvcs_submit_msg % { 'message' : msg,
@@ -76,6 +82,9 @@ class HgSubmitter(BrowserMixin):
76
82
        hg pull -u
77
83
        hg update <branch_name>
78
84
        """
79
        self._clean_dir()
80
        commands.pull(self.repo.ui, self.repo, rev=None, force=False, update=True)
81
        commands.update(self.repo.ui, self.repo, self.sresource.branch.name)
85
        try:
86
            self._clean_dir()
87
            commands.pull(self.repo.ui, self.repo, rev=None, force=False, update=True)
88
            commands.update(self.repo.ui, self.repo, self.sresource.branch.name)
89
        except RepoError, e:
90
            raise SubmitterError, e