changeset 29805:f09d0004481c

outgoing: adds some default value for argument We are about to introduce a third option to create an outgoing object: 'missingroots'. This argument will be mutually exclusive with 'commonheads' so we implement some default value handling in preparation. This will also help use to make more use of outgoing creation around the code base.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 09 Aug 2016 15:55:44 +0200
parents 7b9157aa752f
children 82e8c86cdd6d
files mercurial/discovery.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/discovery.py	Tue Aug 09 15:26:53 2016 +0200
+++ b/mercurial/discovery.py	Tue Aug 09 15:55:44 2016 +0200
@@ -76,10 +76,15 @@
     The sets are computed on demand from the heads, unless provided upfront
     by discovery.'''
 
-    def __init__(self, repo, commonheads, missingheads):
+    def __init__(self, repo, commonheads=None, missingheads=None):
+        cl = repo.changelog
+        if not missingheads:
+            missingheads = cl.heads()
+        if not commonheads:
+            commonheads = [nullid]
         self.commonheads = commonheads
         self.missingheads = missingheads
-        self._revlog = repo.changelog
+        self._revlog = cl
         self._common = None
         self._missing = None
         self.excluded = []