Picon

[PATCH 00 of 25] Patches for review

Hi Augie,

This is all the patches that are ready for review. (My patches that
is, Peter Arrenbrecht also submitted one.) I'm sending them as one
series to keep the list less cluttered, but they can still be reviewed
incrementally.

The first two patches fix a bug in startrev support, and adapts the
tests to test it.

The third patch fixes a tiny omission in `svn verify'.

The fourth and fifth patch improve our documentation by providing a
new, built-in help topic.

The sixth patch improves an assertion in the test suite a tiny bit.

Patches 7 through 9 add a new test that ensures the log output of
converting all fixtures doesn't change. Patch 7 improves a test
utility function, #8 adds the log files and #9 the actual test.

Patch 10 simply adds the bindings type to the version output.

Patches 11 and 12 are dead code removals; most of the dead code was
probably broken to begin with.

Patches 13 and 14 are minor cleanups to the swig wrapper.

Patch 15 splits out a common module in svnwrap that isn't dependant on
what bindings are used, and can be shared between the two wrappers.
(Continue reading)

Picon

[PATCH 01 of 25] pull: fix shallow clone when lastest change isn't HEAD

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@...>
# Date 1281098620 -7200
# Node ID 0539df2dd4dbafaf3e4cd774fe2d742e2cf7dac4
# Parent  ab454ee515d4142ef8fcbedb53d77a0046a258cc
pull: fix shallow clone when lastest change isn't HEAD.

Previously, using `hg clone --startrev HEAD` when the actual HEAD
revision didn't touch the prefix, would cause it to report that no
changes were found. Using last_changed_rev instead of HEAD fixes
this. In order to better test this scenario, we now clone the trunk
subdirectory of all the fixtures. (Except one, which triggered an
assertion in stupid mode.)

diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
 <at>  <at>  -241,7 +241,7  <at>  <at>  def pull(repo, source, heads=[], force=F
         # we are initializing a new repository
         start = repo.ui.config('hgsubversion', 'startrev', 0)
         if isinstance(start, str) and start.upper() == 'HEAD':
-            start = svn.HEAD
+            start = svn.last_changed_rev
         else:
             start = int(start)

diff --git a/tests/test_startrev.py b/tests/test_startrev.py
--- a/tests/test_startrev.py
+++ b/tests/test_startrev.py
 <at>  <at>  -21,7 +21,7  <at>  <at>  def _do_case(self, name, subdir, stupid)
(Continue reading)

Picon

[PATCH 02 of 25] test_startrev: add a few extra assertions; disable fixtures that fail them

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@...>
# Date 1281098620 -7200
# Node ID fdd4d6303460d97c9a76c929dc0a564d65ea60b6
# Parent  0539df2dd4dbafaf3e4cd774fe2d742e2cf7dac4
test_startrev: add a few extra assertions; disable fixtures that fail them

diff --git a/tests/test_startrev.py b/tests/test_startrev.py
--- a/tests/test_startrev.py
+++ b/tests/test_startrev.py
 <at>  <at>  -20,6 +20,11  <at>  <at>  def _do_case(self, name, subdir, stupid)
     for f in fulltip:
         self.assertMultiLineEqual(fulltip[f].data(), headtip[f].data())

+    self.assertNotEqual(len(fullclone), 0, "full clone shouldn't be empty")
+    self.assertEqual(len(headclone), 1,
+                     "shallow clone should have just one revision, not %d"
+                     % len(headclone))
+
 def buildmethod(case, name, subdir, stupid):
     m = lambda self: self._do_case(case, subdir.strip('/'), stupid)
     m.__name__ = name
 <at>  <at>  -32,10 +37,16  <at>  <at>  attrs = {'_do_case': _do_case,
          }
 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
     skip_dumps = set([
-        # this fixture results in an empty repository, don't use it
-        'project_root_not_repo_root.svndump',
         # this fixture fails with an assertion in stupid mode
         'fetch_missing_files_subdir.svndump',
(Continue reading)

Picon

[PATCH 03 of 25] verify: add end-of-line to ui.write() calls

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@...>
# Date 1281098620 -7200
# Node ID 3605f951c6c06bf1895192d007a3e6152b5bc21e
# Parent  fdd4d6303460d97c9a76c929dc0a564d65ea60b6
verify: add end-of-line to ui.write() calls.

It's prettier this way.

diff --git a/hgsubversion/svncommands.py b/hgsubversion/svncommands.py
--- a/hgsubversion/svncommands.py
+++ b/hgsubversion/svncommands.py
 <at>  <at>  -61,7 +61,7  <at>  <at>  def verify(ui, repo, *args, **opts):
         dmatch = fctx.data() == data
         mmatch = fctx.flags() == mode
         if not (dmatch and mmatch):
-            ui.write('difference in file %s' % fn)
+            ui.write('difference in file %s\n' % fn)
             result = 1

     hgfiles = set(ctx)
 <at>  <at>  -69,7 +69,7  <at>  <at>  def verify(ui, repo, *args, **opts):
     hgfiles.discard('.hgsvnexternals')
     if hgfiles != svnfiles:
         missing = set(hgfiles).symmetric_difference(svnfiles)
-        ui.write('missing files: %s' % (', '.join(missing)))
+        ui.write('missing files: %s\n' % (', '.join(missing)))
         result = 1

     return result
(Continue reading)

Picon

[PATCH 04 of 25] help: add an rst file containing some helpful instructions

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@...>
# Date 1281098620 -7200
# Node ID 227a2473ae50ec649cd1e9a65dbdcac86af19c70
# Parent  3605f951c6c06bf1895192d007a3e6152b5bc21e
help: add an rst file containing some helpful instructions

The new file contains three sections: The first one is based on the
README and contains instructions on how to use hgsubversion. The
second one mentions the most notable shortcomings of hgsubversion. The
third and final section documents how to customise hgsubversion.

diff --git a/hgsubversion/help/subversion.rst b/hgsubversion/help/subversion.rst
new file mode 100644
--- /dev/null
+++ b/hgsubversion/help/subversion.rst
 <at>  <at>  -0,0 +1,137  <at>  <at> 
+Basic Use
+---------
+
+Converting a Subversion repository to Mercurial with hgsubversion is done by
+cloning it. Subversion repositories are specified using the same, regular URL
+syntax as Subversion uses. hgsubversion accepts URIs such as the following:
+
+- http://user:sekrit-hcDgGtZH8xNBDgjK7y7TUQ <at> public.gmane.org/repo
+- https://user-hcDgGtZH8xNBDgjK7y7TUQ <at> public.gmane.org/repo
+- svn://example.com/repo
+- svn+ssh://example.com/repo
+- file:///tmp/repo
+
(Continue reading)

Picon

[PATCH 05 of 25] __init__: activate & advertise the new help topic

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@...>
# Date 1281098620 -7200
# Node ID 63d470be86a123830f7b4c5455711cebf496bab1
# Parent  227a2473ae50ec649cd1e9a65dbdcac86af19c70
__init__: activate & advertise the new help topic.

diff --git a/hgsubversion/__init__.py b/hgsubversion/__init__.py
--- a/hgsubversion/__init__.py
+++ b/hgsubversion/__init__.py
 <at>  <at>  -12,13 +12,8  <at>  <at>  Before using hgsubversion, we *strongly*
 automated tests. See 'README' in the hgsubversion directory for
 details.

-The operation of hgsubversion can be customised with the following variables:
-
-<list not written yet>
-
+For more information and instructions, see :hg:`help subversion`.
 '''
-# TODO: The docstring should be slightly more helpful, and at least mention all
-#       configuration settings we support

 import os
 import sys
 <at>  <at>  -26,6 +21,7  <at>  <at>  import traceback

 from mercurial import commands
 from mercurial import extensions
+from mercurial import help
(Continue reading)

Picon

[PATCH 07 of 25] test_util: support passing files to assertMultiLineEqual()

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@...>
# Date 1281098620 -7200
# Node ID 2c90db21b50cc4facb100a8d7106820868a193bd
# Parent  172831d5b7fc9c986c799f96eaf69fe3703d2abe
test_util: support passing files to assertMultiLineEqual().

diff --git a/tests/test_util.py b/tests/test_util.py
--- a/tests/test_util.py
+++ b/tests/test_util.py
 <at>  <at>  -329,16 +329,26  <at>  <at>  class TestBase(unittest.TestCase):
     def assertMultiLineEqual(self, first, second, msg=None):
         """Assert that two multi-line strings are equal. (Based on Py3k code.)
         """
-        self.assert_(isinstance(first, str),
-                     ('First argument is not a string'))
-        self.assert_(isinstance(second, str),
-                     ('Second argument is not a string'))
+        if isinstance(first, file):
+            firstname = first.name
+            first.seek(0)
+            first = first.readlines()
+        else:
+            firstname = 'a'
+            first = first.splitlines(True)
+
+        if isinstance(second, file):
+            secondname = second.name
+            second.seek(0)
+            second = second.readlines()
(Continue reading)

Picon

[PATCH 06 of 25] test_rebuildmeta: make an assertion more helpful

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@...>
# Date 1281098620 -7200
# Node ID 172831d5b7fc9c986c799f96eaf69fe3703d2abe
# Parent  63d470be86a123830f7b4c5455711cebf496bab1
test_rebuildmeta: make an assertion more helpful.

diff --git a/tests/test_rebuildmeta.py b/tests/test_rebuildmeta.py
--- a/tests/test_rebuildmeta.py
+++ b/tests/test_rebuildmeta.py
 <at>  <at>  -60,7 +60,9  <at>  <at>  def _do_case(self, name, stupid, single)
         srcinfo = srcbi[branch]
         destinfo = destbi[branch]
         if srcinfo[:2] == (None, 0) or destinfo[:2] == (None, 0):
-            self.assert_(srcinfo[2] <= destinfo[2])
+            self.assertTrue(srcinfo[2] <= destinfo[2],
+                            'Latest revision for %s decreased from %d to %d!'
+                            % (branch or 'default', srcinfo[2], destinfo[2]))
             self.assertEqual(srcinfo[0], destinfo[0])
         else:
             pr = sorted(filter(lambda x: x[1] == srcinfo[0] and x[0] <= srcinfo[1],

--

-- 
You received this message because you are subscribed to the Google Groups "hgsubversion" group.
To post to this group, send email to hgsubversion@...
To unsubscribe from this group, send email to hgsubversion+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/hgsubversion?hl=en.

Picon

[PATCH 09 of 25] tests: add test that compares conversion results with stored logs

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@...>
# Date 1281098621 -7200
# Node ID 2d51faa23b0ea75e52bdf39d985eeafd17bd109f
# Parent  cdc9e94a8d9af6d5885f1988985a8b90e38f466c
tests: add test that compares conversion results with stored logs

This test is more comprehensive compared to most of our current tests,
as it tests not only what we know to test for, but also what we
*don't* know to test for. It ensures that changes to conversion
results don't accidentally creep in, by making all such changes
require explicit approval.

The test is inspired by the Mercurial test Expected test results of
the output of `log --debug' are stored in
logs/${layout}/${fixturename}[_single].out, and actual results are
written to *.err files for both replay and stupid mode. Similar to the
Mercurial test suite, the *.err file is deleted when the contents of
the two files are exact matches meaning that the test succeeded.

diff --git a/tests/test_unchanged.py b/tests/test_unchanged.py
new file mode 100644
--- /dev/null
+++ b/tests/test_unchanged.py
 <at>  <at>  -0,0 +1,87  <at>  <at> 
+import test_util
+
+import os
+import pickle
+import unittest
(Continue reading)

Picon

[PATCH 10 of 25] version: mention bindings type in version

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@...>
# Date 1281099436 -7200
# Node ID bf6d5bf71a37cbbff6d4bfea22bacb3edcaabb74
# Parent  2d51faa23b0ea75e52bdf39d985eeafd17bd109f
version: mention bindings type in version

In addition, the version output has been rejiggered a bit to mention
the version of hgsubversion first.

While at it, `svn' is changed to `Subversion', as this is its the
proper name.

Before:

% hg version --svn
...
svn bindings: 1.6.12
hgsubversion: 1.1.2+45-123ac53a6343

After:

% hg version --svn
...
hgsubversion: 1.1.2+45-123ac53a6343
Subversion: 1.6.12
bindings: SWIG

diff --git a/hgsubversion/svnwrap/svn_swig_wrapper.py b/hgsubversion/svnwrap/svn_swig_wrapper.py
--- a/hgsubversion/svnwrap/svn_swig_wrapper.py
(Continue reading)


Gmane