/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/vcs/bzr.py

  • Committer: Tim Marston
  • Date: 2016-02-13 14:18:32 UTC
  • Revision ID: tim@ed.am-20160213141832-o0odt4p3nuj97211
switched init command (and update command) to checking for conflicts prior to
deployment.copy_out(), and removed remaining references to CopyInConflict
(supposedly done in r24)

Show diffs side-by-side

added added

removed removed

38
38
                self.dir = dir
39
39
 
40
40
 
41
 
        def has_authority( self ):
42
 
                """Check that the directory is under this VCS's control.
43
 
                """
44
 
 
45
 
                return os.path.exists( os.path.join( self.dir, '.bzr' ) )
46
 
 
47
 
 
48
 
        def expand_repo_url( self, url ):
49
 
                """Convert a simple hostname in to an URL that the VCS can use.
50
 
                """
51
 
 
52
 
                return 'bzr+ssh://%s/%s/%s' % ( url, the.dir, the.repo.name )
53
 
 
54
 
 
55
41
        def init( self ):
56
42
                """Create a new, empty branch
57
43
                """
100
86
                """Obtain some sort of revision identifier
101
87
                """
102
88
 
103
 
                # bzr revno
 
89
                # bzr revert
104
90
                output = self.run( [ 'bzr', 'revno', '--tree' ] )
105
91
 
106
92
                # parse revno
123
109
                # symlink to a non-existant file)
124
110
                if 'kind changed' in files:
125
111
                        for file in files[ 'kind changed' ]:
126
 
                                matches = re.search( '^(.+?)[/@+]? \([^)]+\)$', file )
 
112
                                matches = re.match( r'(.+?)[/@+]? \([^)]+\)', file )
127
113
                                if not matches:
128
114
                                        raise RunTimeError(
129
115
                                                'failed to parse bzr kind change: %s' % file )
147
133
                # remove unknown files
148
134
                if 'unknown' in files:
149
135
                        for file in files[ 'unknown' ]:
150
 
                                matches = re.search( r'^(.+?)[/@+]?$', file )
151
 
                                if not matches:
152
 
                                        raise RunTimeError(
153
 
                                                'failed to parse bzr unknowns: %s' % file )
154
 
                                file = matches.group( 1 )
155
136
                                if the.verbose >= 2: print "removing (unknown): " + file
156
137
                                full_file = os.path.join( self.dir, file )
157
 
                                if os.path.isfile( full_file ) or os.path.islink( full_file ):
 
138
                                if os.path.isfile( full_file ):
158
139
                                        os.unlink( full_file )
159
140
                                elif os.path.isdir( full_file ):
160
141
                                        shutil.rmtree( full_file )
222
203
                for line in buf:
223
204
                        if not re.search( '^[-R+ ?][K NMD!][* ] ', line ): continue
224
205
                        line = line.rstrip()
 
206
                        if the.verbose >= 2: print '  %s' % line
225
207
 
226
208
                        # renames show before and after file names
227
209
                        matches = re.search( '^R.. (.*?)[/@+]? => (.*?)[/@+]?$', line )
296
278
                output = p.communicate()[ 0 ]
297
279
                if p.returncode > 0:
298
280
                        raise self.VcsError( ' '.join( cmd[ : 2 ] ), output )
299
 
                if the.verbose >= 2:
300
 
                        verbose_output = output.rstrip()
301
 
                        if len( verbose_output ):
302
 
                                print re.sub( '(^|\n)', '\\1  : ', verbose_output )
303
281
                return output
304
282
 
305
283