[PATCH 1 of 3] convert/svn: clarify svn_source.latest() stop arg default value

Patrick Mezard patrick at mezard.eu
Wed Apr 18 12:12:57 UTC 2012


# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1334750697 -7200
# Branch stable
# Node ID a292161acb176b1f59efc7c411a6ab2d0dbb8af8
# Parent  baa06fb69ecefdc0686cabe2640f87033f12f4bf
convert/svn: clarify svn_source.latest() stop arg default value

stop=0 could pass for a valid default value at first sight.

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -555,18 +555,20 @@
     def revnum(self, rev):
         return int(rev.split('@')[-1])
 
-    def latest(self, path, stop=0):
-        """Find the latest revid affecting path, up to stop. It may return
-        a revision in a different module, since a branch may be moved without
-        a change being reported. Return None if computed module does not
-        belong to rootmodule subtree.
+    def latest(self, path, stop=None):
+        """Find the latest revid affecting path, up to stop revision
+        number. If stop is None, default to repository latest
+        revision. It may return a revision in a different module,
+        since a branch may be moved without a change being
+        reported. Return None if computed module does not belong to
+        rootmodule subtree.
         """
         if not path.startswith(self.rootmodule):
             # Requests on foreign branches may be forbidden at server level
             self.ui.debug('ignoring foreign branch %r\n' % path)
             return None
 
-        if not stop:
+        if stop is None:
             stop = svn.ra.get_latest_revnum(self.ra)
         try:
             prevmodule = self.reparent('')


More information about the Mercurial-devel mailing list