/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/vcs.py

  • Committer: Tim Marston
  • Date: 2016-12-13 21:40:34 UTC
  • Revision ID: tim@ed.am-20161213214034-nd5t7ztnlrjd627i
fix add command and generic filename expansion/resolution to expend to
homedir-relative filename and absolute filename based on original filename, as
specified, rather than a fully, symlink-resolved filename.  So, e.g., if ~/bob
was a symlink to ~/fred, then ~/bob/a would resolve to the relative filename
bob/a, becuase it is inside the homedir (it would resolve to fred/a otherwise)

Show diffs side-by-side

added added

removed removed

22
22
class Vcs:
23
23
 
24
24
 
 
25
        vcses = [ 'bzr' ]
 
26
 
 
27
 
 
28
        @staticmethod
 
29
        def instantiate_vcs( vcs, full_dir ):
 
30
 
 
31
                # calculate module and class name
 
32
                class_name = module_name = ''
 
33
                bits = vcs.split( '-' )
 
34
                for bit in bits:
 
35
                        class_name += bit[ 0 ].upper() + bit[ 1 : ]
 
36
                        if module_name: module_name += '_'
 
37
                        module_name += bit
 
38
                class_name += 'Vcs'
 
39
                module_name = 'stdhome.vcs.' + module_name
 
40
 
 
41
                # instantiate
 
42
                module = __import__( module_name, fromlist = [ class_name ] )
 
43
                return getattr( module, class_name )( full_dir )
 
44
 
 
45
 
25
46
        class VcsError( Exception ):
26
47
 
27
48
                def __init__( self, message, output = None ):