[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[SVNMERGE][PATCH] handle -r X-Y, where X > Y

From: Madan U Sreenivasan <madan_at_collab.net>
Date: 2006-05-16 00:52:37 CEST

[[[
Accept -rX-Y, for all svnmerge commands, where X > Y.
Before this patch, empty RevisionSet()s were created when X > Y.

* contrib/client-side/svnmerge_test.py
    (TestCase_RevisionSet.test_reverse_order_input_string): New test. Try
     creating a RevisionSet() with a string range, in descending order.

* contrib/client-side/svnmerge.py
    (RevisionSet.__init__): Sort the input revision range before filling in
     RevisionSet._revs.
]]]

Index: contrib/client-side/svnmerge_test.py
===================================================================
--- contrib/client-side/svnmerge_test.py (revision 19641)
+++ contrib/client-side/svnmerge_test.py (working copy)
@@ -89,6 +89,18 @@
         self.assert_(2 in rs)
         self.assert_(9 not in rs)
 
+ def test_descending_order_input_string(self):
+ """Pass a range in descending order and see if RevisionSet() works."""
+ rs = svnmerge.RevisionSet("45-30")
+ self.assert_(30 in rs)
+ self.assert_(32 in rs)
+ self.assert_(39 in rs)
+ self.assert_(44 in rs)
+ self.assert_(45 in rs)
+ self.assert_(29 not in rs)
+ self.assert_(46 not in rs)
+ self.assert_(47 not in rs)
+
     def test_constr_dict(self):
         rs = svnmerge.RevisionSet({18:1, 24:1, 25:1, 43:1})
         self.assert_(24 in rs)
Index: contrib/client-side/svnmerge.py
===================================================================
--- contrib/client-side/svnmerge.py (revision 19641)
+++ contrib/client-side/svnmerge.py (working copy)
@@ -454,8 +454,12 @@
                     if len(rev_or_revs) == 1:
                         self._revs[int(rev_or_revs[0])] = 1
                     elif len(rev_or_revs) == 2:
- for rev in range(int(rev_or_revs[0]),
- int(rev_or_revs[1])+1):
+ # handle revision ranges provided in descending order.
+ # convert to int before further use
+ rev_or_revs = map(int, rev_or_revs)
+ rev_or_revs.sort()
+ for rev in range(rev_or_revs[0],
+ rev_or_revs[1]+1):
                             self._revs[rev] = 1
                     else:
                         raise ValueError, 'Ill formatted revision range: ' + R

Accept -rX-Y, for all svnmerge commands, where X > Y.
Before this patch, empty RevisionSet()s were created when X > Y.

* contrib/client-side/svnmerge_test.py
  (TestCase_RevisionSet.test_reverse_order_input_string): New test. Try
   creating a RevisionSet() with a string range, in descending order.

* contrib/client-side/svnmerge.py
  (RevisionSet.__init__): Sort the input revision range before filling in
   RevisionSet._revs.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue May 16 00:22:54 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.