Patchwork [13,of,16] ancestor: add a way to test whether a missing ancestor object has bases

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 16, 2014, 9:17 a.m.
Message ID <124d0f634a52d89c5ca2.1416129435@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6762/
State Accepted
Commit 83225aff0265e76647d1e627d1723e0afb0befdf
Headers show

Comments

Siddharth Agarwal - Nov. 16, 2014, 9:17 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1416127169 28800
#      Sun Nov 16 00:39:29 2014 -0800
# Node ID 124d0f634a52d89c5ca2780a9c052ae785b32f7c
# Parent  e189800f0eb87e338977a384bbd54399b6635035
ancestor: add a way to test whether a missing ancestor object has bases

This is pretty trivial so there's no unit test coverage for it.

This will be used by setdiscovery.

Patch

diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py
--- a/mercurial/ancestor.py
+++ b/mercurial/ancestor.py
@@ -146,6 +146,10 @@ 
             self.bases.add(nullrev)
         self.pfunc = pfunc
 
+    def hasbases(self):
+        '''whether the common set has any non-trivial bases'''
+        return self.bases and self.bases != set([nullrev])
+
     def missingancestors(self, revs):
         '''return all the ancestors of revs that are not ancestors of self.bases