[PATCH 2 of 2] unionrepo: override the _phasecache() to return a union phasecaches of two repos
elson.wei at gmail.com
elson.wei at gmail.com
Fri Mar 28 01:33:18 UTC 2014
# HG changeset patch
# User Wei, Elson <elson.wei at gmail.com>
# Date 1395970218 -28800
# Fri Mar 28 09:30:18 2014 +0800
# Node ID 209c9e7394bb8b59b01048abe2cc225456132eca
# Parent 077d695569cc1c6012b3aa6fb742b9dac22b133d
unionrepo: override the _phasecache() to return a union phasecaches of two repos
The phase roots of the repo2 are not loaded. All revisions in repo2 will become
'public'.
diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py
--- a/mercurial/unionrepo.py
+++ b/mercurial/unionrepo.py
@@ -15,7 +15,7 @@
from i18n import _
import os
import util, mdiff, cmdutil, scmutil
-import localrepo, changelog, manifest, filelog, revlog
+import localrepo, changelog, manifest, filelog, revlog, phases
class unionrevlog(revlog.revlog):
def __init__(self, opener, indexfile, revlog2, linkmapper):
@@ -177,6 +177,12 @@
self.repo2 = localrepo.localrepository(ui, path2)
@localrepo.unfilteredpropertycache
+ def _phasecache(self):
+ cache = phases.phasecache(self, self._phasedefaults)
+ cache.union(phases.phasecache(self.repo2, self._phasedefaults))
+ return cache
+
+ @localrepo.unfilteredpropertycache
def changelog(self):
return unionchangelog(self.sopener, self.repo2.sopener)
diff --git a/tests/test-unionrepo.t b/tests/test-unionrepo.t
--- a/tests/test-unionrepo.t
+++ b/tests/test-unionrepo.t
@@ -148,3 +148,9 @@
2:68c0685446a3 repo1-2
1:8a58db72e69d repo1-1
0:f093fec0529b repo1-0
+
+check the phase
+
+ $ hg -R union:repo1+repo2 phase -r 0:1
+ 0: draft
+ 1: draft
More information about the Mercurial-devel
mailing list