/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/walker/copy_out.py

  • Committer: Tim Marston
  • Date: 2021-09-01 12:55:15 UTC
  • Revision ID: tim@ed.am-20210901125515-i6b5rxcrceofwm1e
- made basic_statement::step() protected, for use by query and command only
- moved basic_statement::operator<<() to command and query instead; one needs to accept sqlite::exec, the other doesn't
- added tests for query::operator<<()
- added code to invlaidate in-progress queries during any transaction rollbacks (currently segfaults in basic_statement::finalize())
- added new sqlite_error constructor that obtains a full error message
- implemented database::database_mutex_guard class
- swapped command's step mutex in favour of the database mutexupdates for bzr->bzr filename change

Show diffs side-by-side

added added

removed removed

20
20
 
21
21
 
22
22
import re
23
 
from copy_base import CopyBaseWalker
 
23
from .copy_base import CopyBaseWalker
24
24
import stdhome.the as the
 
25
from stdhome.file_matcher import FileMatcher
25
26
 
26
27
 
27
28
class CopyOutWalker( CopyBaseWalker ):
28
29
        """The copy-out walker traverses the repo, copying its content to the home
29
 
        directory.  It is run *after* checking for conflicts that might occur during
30
 
        copy-out, so any conflicts that exist can be assumed to be unimportant and
31
 
        disposable.  In other words, this will happily overwrite stuff in the home
32
 
        directory, without regard to its content.
 
30
        directory.  During an update, it is run *after* checking for conflicts that
 
31
        might occur during copy-out, so any conflicts that exist can be assumed to
 
32
        be unimportant and disposable.  In other words, this will happily overwrite
 
33
        stuff in the home directory, without regard to its content.
33
34
 
34
35
        Walker source:       repo
35
36
        Walker destination:  home dir
37
38
                                                        that no longer exists in the repo
38
39
        """
39
40
 
40
 
        def __init__( self, updated_files = None ):
 
41
        def __init__( self, walk_files = None, report = True ):
 
42
                CopyBaseWalker.__init__( self )
41
43
                self.src_dir = the.repo.full_dir
42
44
                self.dst_dir = the.full_home_dir
43
 
                self.walk_list = updated_files if updated_files is not None else \
 
45
                self.walk_list = walk_files if walk_files is not None else \
44
46
                                                 self.generate_walk_list( the.repo.full_dir )
45
 
 
46
 
 
47
 
        def print_op( self, rel_file, operation ):
48
 
                operation = re.sub( r'(.)(.)(.)', r'\3\2\1', operation )
49
 
                operation = re.sub( r'\>', r'<', operation )
50
 
                print "  %s %s" % ( operation, rel_file )
 
47
                self.check_dst_symlinks = True
 
48
                self.check_dst_ignores = True
 
49
                self.report = report
 
50
 
 
51
 
 
52
        def print_op( self, rel_file, src, op, dst ):
 
53
 
 
54
                CopyBaseWalker.print_op( self, rel_file, src, op, dst )
 
55
 
 
56
                # verbose reporting
 
57
                if the.verbose >= 2:
 
58
                        if op == '*': op = '<'
 
59
                        print("  %s%s%s %s" % ( src, op, dst, rel_file ))