comparison hgsubversion/svnmeta.py @ 1259:b7b0ed1e1455

svnmeta: reorder code in __init__ for easier reading
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 24 Mar 2014 11:20:48 -0500
parents 9490a3052935
children 51f88d3aa4dd
comparison
equal deleted inserted replaced
1257:bc3d0e496424 1259:b7b0ed1e1455
20 """path is the path to the target hg repo. 20 """path is the path to the target hg repo.
21 21
22 subdir is the subdirectory of the edits *on the svn server*. 22 subdir is the subdirectory of the edits *on the svn server*.
23 It is needed for stripping paths off in certain cases. 23 It is needed for stripping paths off in certain cases.
24 """ 24 """
25 # simple and public variables
25 self.ui = repo.ui 26 self.ui = repo.ui
26 self.repo = repo 27 self.repo = repo
27 self.path = os.path.normpath(repo.join('..')) 28 self.path = os.path.normpath(repo.join('..'))
29 self.firstpulled = 0
30 self.lastdate = '1970-01-01 00:00:00 -0000'
31 self.addedtags = {}
32 self.deletedtags = {}
33
34 # private variables
28 self._skiperror = skiperrorcheck 35 self._skiperror = skiperrorcheck
29 36 self._tags = None
37 self._layoutobj = None
38 self._revmap = None
39 self._authors = None
40 self._branchmap = None
41 self._tagmap = None
42 self._filemap = None
43
44 # create .hg/svn folder if it doesn't exist
30 if not os.path.isdir(self.metapath): 45 if not os.path.isdir(self.metapath):
31 os.makedirs(self.metapath) 46 os.makedirs(self.metapath)
47
48 # properties that need .hg/svn to exist
32 self.uuid = uuid 49 self.uuid = uuid
33 self.subdir = subdir 50 self.subdir = subdir
34 self._revmap = None 51
35 self.firstpulled = 0 52 # generated properties that have a persistent file stored on disk
36
37 self._gen_cachedconfig('lastpulled', 0, configname=False) 53 self._gen_cachedconfig('lastpulled', 0, configname=False)
38 self._gen_cachedconfig('defaultauthors', True) 54 self._gen_cachedconfig('defaultauthors', True)
39 self._gen_cachedconfig('caseignoreauthors', False) 55 self._gen_cachedconfig('caseignoreauthors', False)
40 self._gen_cachedconfig('defaulthost', self.uuid) 56 self._gen_cachedconfig('defaulthost', self.uuid)
41 self._gen_cachedconfig('usebranchnames', True) 57 self._gen_cachedconfig('usebranchnames', True)
42 58
59 # misc
43 self.branches = util.load(self.branch_info_file) or {} 60 self.branches = util.load(self.branch_info_file) or {}
44 self.prevbranches = dict(self.branches) 61 self.prevbranches = dict(self.branches)
45 self._tags = None
46 self._layout = layouts.detect.layout_from_file(self.metapath, 62 self._layout = layouts.detect.layout_from_file(self.metapath,
47 ui=self.repo.ui) 63 ui=self.repo.ui)
48 self._layoutobj = None
49
50 self._authors = None
51
52 self._branchmap = None
53
54 self._tagmap = None
55
56 self._filemap = None
57
58 self.lastdate = '1970-01-01 00:00:00 -0000'
59 self.addedtags = {}
60 self.deletedtags = {}
61 64
62 def _get_cachedconfig(self, name, filename, configname, default): 65 def _get_cachedconfig(self, name, filename, configname, default):
63 """Return a cached value for a config option. If the cache is uninitialized 66 """Return a cached value for a config option. If the cache is uninitialized
64 then try to read its value from disk. Option can be overridden by the 67 then try to read its value from disk. Option can be overridden by the
65 commandline. 68 commandline.