/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: 2014-04-05 22:30:23 UTC
  • Revision ID: tim@ed.am-20140405223023-3co87mbvnxwk1l65
added revert command

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
                                        raise RunTimeError(
114
114
                                                'failed to parse bzr kind change: %s' % file )
115
115
                                file = matches.group( 1 )
116
 
                                if the.verbose >= 2: print "removing (kind changed): " + file
 
116
                                if the.verbose > 1: print "removing (kind changed): " + file
117
117
                                full_file = os.path.join( self.dir, file )
118
118
                                if os.path.isfile( full_file ) or os.path.islink( full_file ):
119
119
                                        os.unlink( full_file )
132
132
                # remove unknown files
133
133
                if 'unknown' in files:
134
134
                        for file in files[ 'unknown' ]:
135
 
                                if the.verbose >= 2: print "removing (unknown): " + file
 
135
                                if the.verbose > 1: print "removing (unknown): " + file
136
136
                                full_file = os.path.join( self.dir, file )
137
137
                                if os.path.isfile( full_file ):
138
138
                                        os.unlink( full_file )
202
202
                for line in buf:
203
203
                        if not re.search( '^[-R+ ?][K NMD!][* ] ', line ): continue
204
204
                        line = line.rstrip()
205
 
                        if the.verbose >= 2: print '  %s' % line
 
205
                        if the.verbose > 1: print '  %s' % line
206
206
 
207
207
                        # renames show before and after file names
208
208
                        matches = re.search( '^R.. (.*?)[/@+]? => (.*?)[/@+]?$', line )
253
253
                return files['conflicts'] if 'conflicts' in files else None
254
254
 
255
255
 
256
 
        def add( self, files ):
257
 
                """Make sure files are added to version control.
258
 
                @param files a list of relative filenames
259
 
                """
260
 
 
261
 
                # bzr add
262
 
                self.run( [ 'bzr', 'add' ] + files )
263
 
 
264
 
 
265
 
        def commit( self ):
266
 
                """Commit changes to the repo.
267
 
                """
268
 
 
269
 
                # bzr commit
270
 
                self.run( [ 'bzr', 'commit', '-m', '' ] )
271
 
 
272
 
 
273
256
        def run( self, cmd ):
274
 
                if the.verbose >= 2: print 'exec: %s' % ' '.join( cmd )
 
257
                if the.verbose > 1: print 'exec: %s' % ' '.join( cmd )
275
258
                p = Popen( cmd, cwd = self.dir,
276
259
                                   stdout = subprocess.PIPE, stderr = subprocess.STDOUT )
277
260
                output = p.communicate()[ 0 ]