/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-07-30 19:09:02 UTC
  • Revision ID: tim@ed.am-20140730190902-bkuu372rya4zokm8
added info for add command to --help; fixed bug with add command where all files
in directories could be added to the commit instead of just the ones you've
specified

Show diffs side-by-side

added added

removed removed

34
34
 
35
35
                @param dir the fully-qualified directory to work in.
36
36
                """
37
 
 
38
37
                self.dir = dir
39
38
 
40
39
 
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
40
        def init( self ):
56
41
                """Create a new, empty branch
57
42
                """
100
85
                """Obtain some sort of revision identifier
101
86
                """
102
87
 
103
 
                # bzr revno
 
88
                # bzr revert
104
89
                output = self.run( [ 'bzr', 'revno', '--tree' ] )
105
90
 
106
91
                # parse revno
123
108
                # symlink to a non-existant file)
124
109
                if 'kind changed' in files:
125
110
                        for file in files[ 'kind changed' ]:
126
 
                                matches = re.search( '^(.+?)[/@+]? \([^)]+\)$', file )
 
111
                                matches = re.match( r'(.+?)[/@+]? \([^)]+\)', file )
127
112
                                if not matches:
128
113
                                        raise RunTimeError(
129
114
                                                'failed to parse bzr kind change: %s' % file )
147
132
                # remove unknown files
148
133
                if 'unknown' in files:
149
134
                        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
135
                                if the.verbose >= 2: print "removing (unknown): " + file
156
136
                                full_file = os.path.join( self.dir, file )
157
 
                                if os.path.isfile( full_file ) or os.path.islink( full_file ):
 
137
                                if os.path.isfile( full_file ):
158
138
                                        os.unlink( full_file )
159
139
                                elif os.path.isdir( full_file ):
160
140
                                        shutil.rmtree( full_file )
222
202
                for line in buf:
223
203
                        if not re.search( '^[-R+ ?][K NMD!][* ] ', line ): continue
224
204
                        line = line.rstrip()
 
205
                        if the.verbose >= 2: print '  %s' % line
225
206
 
226
207
                        # renames show before and after file names
227
208
                        matches = re.search( '^R.. (.*?)[/@+]? => (.*?)[/@+]?$', line )
296
277
                output = p.communicate()[ 0 ]
297
278
                if p.returncode > 0:
298
279
                        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
280
                return output
304
281
 
305
282