mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
utility_commands: fix hg svn genignore for single-directory mode
This commit is contained in:
parent
ebcd96fd15
commit
555e763e54
@ -17,12 +17,16 @@ def genignore(ui, repo, force=False, **opts):
|
||||
hashes = meta.revmap.hashes()
|
||||
parent = util.parentrev(ui, repo, meta, hashes)
|
||||
r, br = hashes[parent.node()]
|
||||
branchpath = br and ('branches/%s' % br) or 'trunk'
|
||||
if meta.layout == 'single':
|
||||
branchpath = ''
|
||||
else:
|
||||
branchpath = br and ('branches/%s/' % br) or 'trunk/'
|
||||
ignorelines = ['.hgignore', 'syntax:glob']
|
||||
dirs = [''] + [d[0] for d in svn.list_files(branchpath, r)
|
||||
if d[1] == 'd']
|
||||
for dir in dirs:
|
||||
props = svn.list_props('%s/%s/' % (branchpath, dir), r)
|
||||
path = '%s%s' % (branchpath, dir)
|
||||
props = svn.list_props(path, r)
|
||||
if 'svn:ignore' not in props:
|
||||
continue
|
||||
lines = props['svn:ignore'].strip().split('\n')
|
||||
|
@ -212,6 +212,15 @@ class UtilityTests(test_util.TestBase):
|
||||
self.assertEqual(open(os.path.join(self.wc_path, '.hgignore')).read(),
|
||||
'.hgignore\nsyntax:glob\nblah\notherblah\nbaz/magic\n')
|
||||
|
||||
def test_genignore_single(self):
|
||||
self._load_fixture_and_fetch('ignores.svndump', subdir='trunk')
|
||||
hg.update(self.repo, 'tip')
|
||||
u = ui.ui()
|
||||
u.pushbuffer()
|
||||
utility_commands.genignore(u, self.repo, self.wc_path)
|
||||
self.assertStringEqual(open(os.path.join(self.wc_path, '.hgignore')).read(),
|
||||
'.hgignore\nsyntax:glob\nblah\notherblah\nbaz/magic\n')
|
||||
|
||||
def test_list_authors(self):
|
||||
test_util.load_svndump_fixture(self.repo_path,
|
||||
'replace_trunk_with_branch.svndump')
|
||||
|
Loading…
Reference in New Issue
Block a user