changegroup: move source check to top of addchangegroup
authorAugie Fackler <augie@google.com>
Tue, 13 Oct 2015 15:54:05 -0400
changeset 26694 c2e6e3cc7cb4
parent 26693 338af85109dd
child 26695 1121fced5b20
changegroup: move source check to top of addchangegroup This is preparation for some refactoring.
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Thu Oct 15 09:52:32 2015 -0400
+++ b/mercurial/changegroup.py	Tue Oct 13 15:54:05 2015 -0400
@@ -730,6 +730,9 @@
     - fewer heads than before: -1-removed heads (-2..-n)
     - number of heads stays the same: 1
     """
+    if not source:
+        return 0
+
     repo = repo.unfiltered()
     def csmap(x):
         repo.ui.debug("add changeset %s\n" % short(x))
@@ -738,9 +741,6 @@
     def revmap(x):
         return cl.rev(x)
 
-    if not source:
-        return 0
-
     changesets = files = revisions = 0
 
     tr = repo.transaction("\n".join([srctype, util.hidepassword(url)]))