/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/branch.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-09-30 09:09:18 UTC
  • mto: (0.14.3 main)
  • mto: This revision was merged to the branch mainline in revision 86.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060930090918-fc1af202783b08c0
Some sensitivity changes; branching (get) fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import sys
 
17
import os
18
18
 
19
19
try:
20
20
    import pygtk
25
25
import gtk
26
26
import gtk.glade
27
27
 
 
28
from bzrlib.branch import Branch
28
29
import bzrlib.errors as errors
29
 
from __init__ import gladefile
 
30
 
 
31
from olive import gladefile
 
32
from dialog import error_dialog, info_dialog
30
33
 
31
34
class OliveBranch:
32
35
    """ Display branch dialog and perform the needed operations. """
57
60
        location = entry_location.get_text()
58
61
        if location is '':
59
62
            error_dialog(_('Missing branch location'),
60
 
                                     _('You must specify a branch location.'))
 
63
                         _('You must specify a branch location.'))
61
64
            return
62
65
        
63
66
        destination = self.filechooser.get_filename()
64
67
        
65
68
        spinbutton_revno = self.glade.get_widget('spinbutton_branch_revno')
66
69
        revno = spinbutton_revno.get_value_as_int()
67
 
        revision_id = br_from.get_rev_id(revno)
68
70
        
69
71
        try:
70
72
            from bzrlib.transport import get_transport
71
73
 
72
74
            br_from = Branch.open(location)
73
75
            br_from.lock_read()
 
76
            
 
77
            revision_id = br_from.get_rev_id(revno)
74
78
 
75
79
            try:
76
80
                destination = destination + '/' + os.path.basename(location.rstrip("/\\"))
80
84
                try:
81
85
                    dir = br_from.bzrdir.sprout(to_transport.base, revision_id)
82
86
                    branch = dir.open_branch()
83
 
                except NoSuchRevision:
 
87
                    revs = branch.revno()
 
88
                except errors.NoSuchRevision:
84
89
                    to_transport.delete_tree('.')
85
90
                    raise
86
91
 
92
97
                        _('%d revision(s) branched.') % revs)
93
98
        except errors.NonExistingSource, errmsg:
94
99
            error_dialog(_('Non existing source'),
95
 
                                     _("The location (%s)\ndoesn't exist.") % errmsg)
 
100
                         _("The location (%s)\ndoesn't exist.") % errmsg)
96
101
            return
97
102
        except errors.TargetAlreadyExists, errmsg:
98
103
            error_dialog(_('Target already exists'),
99
 
                                     _('Target directory (%s)\nalready exists. Please select another target.') % errmsg)
 
104
                         _('Target directory (%s)\nalready exists. Please select another target.') % errmsg)
100
105
            return
101
106
        except errors.NonExistingParent, errmsg:
102
107
            error_dialog(_('Non existing parent directory'),
103
 
                                     _("The parent directory (%s)\ndoesn't exist.") % errmsg)
 
108
                         _("The parent directory (%s)\ndoesn't exist.") % errmsg)
104
109
            return
105
110
        except errors.NonExistingRevision:
106
111
            error_dialog(_('Non existing revision'),
107
 
                                     _("The revision you specified doesn't exist."))
 
112
                         _("The revision you specified doesn't exist."))
108
113
            return
109
114
        except errors.NotBranchError, errmsg:
110
115
            error_dialog(_('Location is not a branch'),
111
 
                                     _('The specified location has to be a branch.'))
 
116
                         _('The specified location has to be a branch.'))
112
117
            return
113
118
        
114
 
 
115
119
    def close(self, widget=None):
116
120
        self.window.destroy()