/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 11:38:50 UTC
  • Revision ID: tim@ed.am-20160213113850-iaplsdx6h1y4l21b
switch to lzip

Show diffs side-by-side

added added

removed removed

86
86
                """Obtain some sort of revision identifier
87
87
                """
88
88
 
89
 
                # bzr revno
 
89
                # bzr revert
90
90
                output = self.run( [ 'bzr', 'revno', '--tree' ] )
91
91
 
92
92
                # parse revno
109
109
                # symlink to a non-existant file)
110
110
                if 'kind changed' in files:
111
111
                        for file in files[ 'kind changed' ]:
112
 
                                matches = re.search( '^(.+?)[/@+]? \([^)]+\)$', file )
 
112
                                matches = re.match( r'(.+?)[/@+]? \([^)]+\)', file )
113
113
                                if not matches:
114
114
                                        raise RunTimeError(
115
115
                                                'failed to parse bzr kind change: %s' % file )
133
133
                # remove unknown files
134
134
                if 'unknown' in files:
135
135
                        for file in files[ 'unknown' ]:
136
 
                                matches = re.search( r'^(.+?)[/@+]?$', file )
137
 
                                if not matches:
138
 
                                        raise RunTimeError(
139
 
                                                'failed to parse bzr unknowns: %s' % file )
140
 
                                file = matches.group( 1 )
141
136
                                if the.verbose >= 2: print "removing (unknown): " + file
142
137
                                full_file = os.path.join( self.dir, file )
143
 
                                if os.path.isfile( full_file ) or os.path.islink( full_file ):
 
138
                                if os.path.isfile( full_file ):
144
139
                                        os.unlink( full_file )
145
140
                                elif os.path.isdir( full_file ):
146
141
                                        shutil.rmtree( full_file )
208
203
                for line in buf:
209
204
                        if not re.search( '^[-R+ ?][K NMD!][* ] ', line ): continue
210
205
                        line = line.rstrip()
 
206
                        if the.verbose >= 2: print '  %s' % line
211
207
 
212
208
                        # renames show before and after file names
213
209
                        matches = re.search( '^R.. (.*?)[/@+]? => (.*?)[/@+]?$', line )
282
278
                output = p.communicate()[ 0 ]
283
279
                if p.returncode > 0:
284
280
                        raise self.VcsError( ' '.join( cmd[ : 2 ] ), output )
285
 
                if the.verbose >= 2:
286
 
                        print re.sub( '(^|\n)', '\\1  > ', output.rstrip() )
287
281
                return output
288
282
 
289
283