changeset 549:b97f5734e5a8

utility_commands: unbreak hg svn info with single-directory clones
author Augie Fackler <durin42@gmail.com>
date Sat, 06 Feb 2010 10:57:58 -0600
parents 2148eb4b4da4
children f0159775e0f1
files hgsubversion/utility_commands.py tests/test_utility_commands.py
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/utility_commands.py
+++ b/hgsubversion/utility_commands.py
@@ -48,7 +48,9 @@ def info(ui, repo, hg_repo_path, **opts)
         return 0
     r, br = hashes[pn]
     subdir = parent.extra()['convert_revision'][40:].split('@')[0]
-    if br == None:
+    if meta.layout == 'single':
+        branchpath = ''
+    elif br == None:
         branchpath = '/trunk'
     elif br.startswith('../'):
         branchpath = '/%s' % br[3:]
--- a/tests/test_utility_commands.py
+++ b/tests/test_utility_commands.py
@@ -66,6 +66,21 @@ class UtilityTests(test_util.TestBase):
                      })
         self.assertEqual(actual, expected)
 
+    def test_info_single(self):
+        self._load_fixture_and_fetch('two_heads.svndump', subdir='trunk')
+        hg.update(self.repo, 'tip')
+        u = ui.ui()
+        u.pushbuffer()
+        utility_commands.info(u, self.repo, self.wc_path)
+        actual = u.popbuffer()
+        expected = (expected_info_output %
+                    {'date': '2008-10-08 01:39:29 +0000 (Wed, 08 Oct 2008)',
+                     'repourl': self.repourl,
+                     'branch': 'trunk',
+                     'rev': 6,
+                     })
+        self.assertStringEqual(expected, actual)
+
     def test_parent_output(self):
         self._load_fixture_and_fetch('two_heads.svndump')
         u = ui.ui()