Mercurial > hgsubversion
comparison tests/test_util.py @ 762:c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
At this point, only pulling externals definitions into .hgsub and .hgsubstate
is supported. One difference between subrepos and svn:externals is the former
separate the source definition and target revision in two files, while
svn:externals definitions contain both. To handle this, the svn:externals
revision references is replaced with a {REV} placeholder and stored in .hgsub,
prefixed with the external base directory separated with a ':', while the
revision is extracted in .hgsubstate.
For instance, the following external:
-r3 ^/externals/proj2@2 deps/proj2
Becomes:
(.hgsub)
deps/proj2 = [hgsubversion] :-r{REV} ^/externals/proj2@2 deps/proj2
(.hgsubstate)
3 deps/proj2
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 25 Nov 2010 21:55:21 +0100 |
parents | 6d6be5284056 |
children | bc5c176b63eb |
comparison
equal
deleted
inserted
replaced
761:979148947967 | 762:c31a1f92e1c6 |
---|---|
170 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 170 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
171 proc.communicate() | 171 proc.communicate() |
172 | 172 |
173 def load_fixture_and_fetch(fixture_name, repo_path, wc_path, stupid=False, | 173 def load_fixture_and_fetch(fixture_name, repo_path, wc_path, stupid=False, |
174 subdir='', noupdate=True, layout='auto', | 174 subdir='', noupdate=True, layout='auto', |
175 startrev=0): | 175 startrev=0, externals=None): |
176 load_svndump_fixture(repo_path, fixture_name) | 176 load_svndump_fixture(repo_path, fixture_name) |
177 if subdir: | 177 if subdir: |
178 repo_path += '/' + subdir | 178 repo_path += '/' + subdir |
179 | 179 |
180 cmd = [ | 180 cmd = [ |
186 ] | 186 ] |
187 if stupid: | 187 if stupid: |
188 cmd.append('--stupid') | 188 cmd.append('--stupid') |
189 if noupdate: | 189 if noupdate: |
190 cmd.append('--noupdate') | 190 cmd.append('--noupdate') |
191 if externals: | |
192 cmd[:0] = ['--config', 'hgsubversion.externals=%s' % externals] | |
191 | 193 |
192 dispatch.dispatch(cmd) | 194 dispatch.dispatch(cmd) |
193 | 195 |
194 return hg.repository(testui(), wc_path) | 196 return hg.repository(testui(), wc_path) |
195 | 197 |
273 | 275 |
274 def ui(self, stupid=False, layout='auto'): | 276 def ui(self, stupid=False, layout='auto'): |
275 return testui(stupid, layout) | 277 return testui(stupid, layout) |
276 | 278 |
277 def _load_fixture_and_fetch(self, fixture_name, subdir=None, stupid=False, | 279 def _load_fixture_and_fetch(self, fixture_name, subdir=None, stupid=False, |
278 layout='auto', startrev=0): | 280 layout='auto', startrev=0, externals=None): |
279 if layout == 'single': | 281 if layout == 'single': |
280 if subdir is None: | 282 if subdir is None: |
281 subdir = 'trunk' | 283 subdir = 'trunk' |
282 elif subdir is None: | 284 elif subdir is None: |
283 subdir = '' | 285 subdir = '' |
284 return load_fixture_and_fetch(fixture_name, self.repo_path, | 286 return load_fixture_and_fetch(fixture_name, self.repo_path, |
285 self.wc_path, subdir=subdir, | 287 self.wc_path, subdir=subdir, |
286 stupid=stupid, layout=layout, | 288 stupid=stupid, layout=layout, |
287 startrev=startrev) | 289 startrev=startrev, externals=externals) |
288 | 290 |
289 def _add_svn_rev(self, changes): | 291 def _add_svn_rev(self, changes): |
290 '''changes is a dict of filename -> contents''' | 292 '''changes is a dict of filename -> contents''' |
291 if self.svn_wc is None: | 293 if self.svn_wc is None: |
292 self.svn_wc = os.path.join(self.tmpdir, 'testsvn_wc') | 294 self.svn_wc = os.path.join(self.tmpdir, 'testsvn_wc') |