##// END OF EJS Templates
unionrepo: fix wrong rev being checked in iscensored (issue5024)
Sean Farley -
r27723:bf86e3e8 stable
parent child Browse files
Show More
@@ -1,260 +1,261 b''
1 # unionrepo.py - repository class for viewing union of repository changesets
1 # unionrepo.py - repository class for viewing union of repository changesets
2 #
2 #
3 # Derived from bundlerepo.py
3 # Derived from bundlerepo.py
4 # Copyright 2006, 2007 Benoit Boissinot <bboissin@gmail.com>
4 # Copyright 2006, 2007 Benoit Boissinot <bboissin@gmail.com>
5 # Copyright 2013 Unity Technologies, Mads Kiilerich <madski@unity3d.com>
5 # Copyright 2013 Unity Technologies, Mads Kiilerich <madski@unity3d.com>
6 #
6 #
7 # This software may be used and distributed according to the terms of the
7 # This software may be used and distributed according to the terms of the
8 # GNU General Public License version 2 or any later version.
8 # GNU General Public License version 2 or any later version.
9
9
10 """Repository class for "in-memory pull" of one local repository to another,
10 """Repository class for "in-memory pull" of one local repository to another,
11 allowing operations like diff and log with revsets.
11 allowing operations like diff and log with revsets.
12 """
12 """
13
13
14 from __future__ import absolute_import
14 from __future__ import absolute_import
15
15
16 import os
16 import os
17
17
18 from .i18n import _
18 from .i18n import _
19 from .node import nullid
19 from .node import nullid
20
20
21 from . import (
21 from . import (
22 changelog,
22 changelog,
23 cmdutil,
23 cmdutil,
24 error,
24 error,
25 filelog,
25 filelog,
26 localrepo,
26 localrepo,
27 manifest,
27 manifest,
28 mdiff,
28 mdiff,
29 pathutil,
29 pathutil,
30 revlog,
30 revlog,
31 scmutil,
31 scmutil,
32 util,
32 util,
33 )
33 )
34
34
35 class unionrevlog(revlog.revlog):
35 class unionrevlog(revlog.revlog):
36 def __init__(self, opener, indexfile, revlog2, linkmapper):
36 def __init__(self, opener, indexfile, revlog2, linkmapper):
37 # How it works:
37 # How it works:
38 # To retrieve a revision, we just need to know the node id so we can
38 # To retrieve a revision, we just need to know the node id so we can
39 # look it up in revlog2.
39 # look it up in revlog2.
40 #
40 #
41 # To differentiate a rev in the second revlog from a rev in the revlog,
41 # To differentiate a rev in the second revlog from a rev in the revlog,
42 # we check revision against repotiprev.
42 # we check revision against repotiprev.
43 opener = scmutil.readonlyvfs(opener)
43 opener = scmutil.readonlyvfs(opener)
44 revlog.revlog.__init__(self, opener, indexfile)
44 revlog.revlog.__init__(self, opener, indexfile)
45 self.revlog2 = revlog2
45 self.revlog2 = revlog2
46
46
47 n = len(self)
47 n = len(self)
48 self.repotiprev = n - 1
48 self.repotiprev = n - 1
49 self.bundlerevs = set() # used by 'bundle()' revset expression
49 self.bundlerevs = set() # used by 'bundle()' revset expression
50 for rev2 in self.revlog2:
50 for rev2 in self.revlog2:
51 rev = self.revlog2.index[rev2]
51 rev = self.revlog2.index[rev2]
52 # rev numbers - in revlog2, very different from self.rev
52 # rev numbers - in revlog2, very different from self.rev
53 _start, _csize, _rsize, base, linkrev, p1rev, p2rev, node = rev
53 _start, _csize, _rsize, base, linkrev, p1rev, p2rev, node = rev
54
54
55 if linkmapper is None: # link is to same revlog
55 if linkmapper is None: # link is to same revlog
56 assert linkrev == rev2 # we never link back
56 assert linkrev == rev2 # we never link back
57 link = n
57 link = n
58 else: # rev must be mapped from repo2 cl to unified cl by linkmapper
58 else: # rev must be mapped from repo2 cl to unified cl by linkmapper
59 link = linkmapper(linkrev)
59 link = linkmapper(linkrev)
60
60
61 if linkmapper is not None: # link is to same revlog
61 if linkmapper is not None: # link is to same revlog
62 base = linkmapper(base)
62 base = linkmapper(base)
63
63
64 if node in self.nodemap:
64 if node in self.nodemap:
65 # this happens for the common revlog revisions
65 # this happens for the common revlog revisions
66 self.bundlerevs.add(self.nodemap[node])
66 self.bundlerevs.add(self.nodemap[node])
67 continue
67 continue
68
68
69 p1node = self.revlog2.node(p1rev)
69 p1node = self.revlog2.node(p1rev)
70 p2node = self.revlog2.node(p2rev)
70 p2node = self.revlog2.node(p2rev)
71
71
72 e = (None, None, None, base,
72 e = (None, None, None, base,
73 link, self.rev(p1node), self.rev(p2node), node)
73 link, self.rev(p1node), self.rev(p2node), node)
74 self.index.insert(-1, e)
74 self.index.insert(-1, e)
75 self.nodemap[node] = n
75 self.nodemap[node] = n
76 self.bundlerevs.add(n)
76 self.bundlerevs.add(n)
77 n += 1
77 n += 1
78
78
79 def _chunk(self, rev):
79 def _chunk(self, rev):
80 if rev <= self.repotiprev:
80 if rev <= self.repotiprev:
81 return revlog.revlog._chunk(self, rev)
81 return revlog.revlog._chunk(self, rev)
82 return self.revlog2._chunk(self.node(rev))
82 return self.revlog2._chunk(self.node(rev))
83
83
84 def revdiff(self, rev1, rev2):
84 def revdiff(self, rev1, rev2):
85 """return or calculate a delta between two revisions"""
85 """return or calculate a delta between two revisions"""
86 if rev1 > self.repotiprev and rev2 > self.repotiprev:
86 if rev1 > self.repotiprev and rev2 > self.repotiprev:
87 return self.revlog2.revdiff(
87 return self.revlog2.revdiff(
88 self.revlog2.rev(self.node(rev1)),
88 self.revlog2.rev(self.node(rev1)),
89 self.revlog2.rev(self.node(rev2)))
89 self.revlog2.rev(self.node(rev2)))
90 elif rev1 <= self.repotiprev and rev2 <= self.repotiprev:
90 elif rev1 <= self.repotiprev and rev2 <= self.repotiprev:
91 return self.baserevdiff(rev1, rev2)
91 return self.baserevdiff(rev1, rev2)
92
92
93 return mdiff.textdiff(self.revision(self.node(rev1)),
93 return mdiff.textdiff(self.revision(self.node(rev1)),
94 self.revision(self.node(rev2)))
94 self.revision(self.node(rev2)))
95
95
96 def revision(self, nodeorrev):
96 def revision(self, nodeorrev):
97 """return an uncompressed revision of a given node or revision
97 """return an uncompressed revision of a given node or revision
98 number.
98 number.
99 """
99 """
100 if isinstance(nodeorrev, int):
100 if isinstance(nodeorrev, int):
101 rev = nodeorrev
101 rev = nodeorrev
102 node = self.node(rev)
102 node = self.node(rev)
103 else:
103 else:
104 node = nodeorrev
104 node = nodeorrev
105 rev = self.rev(node)
105 rev = self.rev(node)
106
106
107 if node == nullid:
107 if node == nullid:
108 return ""
108 return ""
109
109
110 if rev > self.repotiprev:
110 if rev > self.repotiprev:
111 text = self.revlog2.revision(node)
111 text = self.revlog2.revision(node)
112 self._cache = (node, rev, text)
112 self._cache = (node, rev, text)
113 else:
113 else:
114 text = self.baserevision(rev)
114 text = self.baserevision(rev)
115 # already cached
115 # already cached
116 return text
116 return text
117
117
118 def baserevision(self, nodeorrev):
118 def baserevision(self, nodeorrev):
119 # Revlog subclasses may override 'revision' method to modify format of
119 # Revlog subclasses may override 'revision' method to modify format of
120 # content retrieved from revlog. To use unionrevlog with such class one
120 # content retrieved from revlog. To use unionrevlog with such class one
121 # needs to override 'baserevision' and make more specific call here.
121 # needs to override 'baserevision' and make more specific call here.
122 return revlog.revlog.revision(self, nodeorrev)
122 return revlog.revlog.revision(self, nodeorrev)
123
123
124 def baserevdiff(self, rev1, rev2):
124 def baserevdiff(self, rev1, rev2):
125 # Exists for the same purpose as baserevision.
125 # Exists for the same purpose as baserevision.
126 return revlog.revlog.revdiff(self, rev1, rev2)
126 return revlog.revlog.revdiff(self, rev1, rev2)
127
127
128 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
128 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
129 raise NotImplementedError
129 raise NotImplementedError
130 def addgroup(self, revs, linkmapper, transaction):
130 def addgroup(self, revs, linkmapper, transaction):
131 raise NotImplementedError
131 raise NotImplementedError
132 def strip(self, rev, minlink):
132 def strip(self, rev, minlink):
133 raise NotImplementedError
133 raise NotImplementedError
134 def checksize(self):
134 def checksize(self):
135 raise NotImplementedError
135 raise NotImplementedError
136
136
137 class unionchangelog(unionrevlog, changelog.changelog):
137 class unionchangelog(unionrevlog, changelog.changelog):
138 def __init__(self, opener, opener2):
138 def __init__(self, opener, opener2):
139 changelog.changelog.__init__(self, opener)
139 changelog.changelog.__init__(self, opener)
140 linkmapper = None
140 linkmapper = None
141 changelog2 = changelog.changelog(opener2)
141 changelog2 = changelog.changelog(opener2)
142 unionrevlog.__init__(self, opener, self.indexfile, changelog2,
142 unionrevlog.__init__(self, opener, self.indexfile, changelog2,
143 linkmapper)
143 linkmapper)
144
144
145 def baserevision(self, nodeorrev):
145 def baserevision(self, nodeorrev):
146 # Although changelog doesn't override 'revision' method, some extensions
146 # Although changelog doesn't override 'revision' method, some extensions
147 # may replace this class with another that does. Same story with
147 # may replace this class with another that does. Same story with
148 # manifest and filelog classes.
148 # manifest and filelog classes.
149 return changelog.changelog.revision(self, nodeorrev)
149 return changelog.changelog.revision(self, nodeorrev)
150
150
151 def baserevdiff(self, rev1, rev2):
151 def baserevdiff(self, rev1, rev2):
152 return changelog.changelog.revdiff(self, rev1, rev2)
152 return changelog.changelog.revdiff(self, rev1, rev2)
153
153
154 class unionmanifest(unionrevlog, manifest.manifest):
154 class unionmanifest(unionrevlog, manifest.manifest):
155 def __init__(self, opener, opener2, linkmapper):
155 def __init__(self, opener, opener2, linkmapper):
156 manifest.manifest.__init__(self, opener)
156 manifest.manifest.__init__(self, opener)
157 manifest2 = manifest.manifest(opener2)
157 manifest2 = manifest.manifest(opener2)
158 unionrevlog.__init__(self, opener, self.indexfile, manifest2,
158 unionrevlog.__init__(self, opener, self.indexfile, manifest2,
159 linkmapper)
159 linkmapper)
160
160
161 def baserevision(self, nodeorrev):
161 def baserevision(self, nodeorrev):
162 return manifest.manifest.revision(self, nodeorrev)
162 return manifest.manifest.revision(self, nodeorrev)
163
163
164 def baserevdiff(self, rev1, rev2):
164 def baserevdiff(self, rev1, rev2):
165 return manifest.manifest.revdiff(self, rev1, rev2)
165 return manifest.manifest.revdiff(self, rev1, rev2)
166
166
167 class unionfilelog(unionrevlog, filelog.filelog):
167 class unionfilelog(unionrevlog, filelog.filelog):
168 def __init__(self, opener, path, opener2, linkmapper, repo):
168 def __init__(self, opener, path, opener2, linkmapper, repo):
169 filelog.filelog.__init__(self, opener, path)
169 filelog.filelog.__init__(self, opener, path)
170 filelog2 = filelog.filelog(opener2, path)
170 filelog2 = filelog.filelog(opener2, path)
171 unionrevlog.__init__(self, opener, self.indexfile, filelog2,
171 unionrevlog.__init__(self, opener, self.indexfile, filelog2,
172 linkmapper)
172 linkmapper)
173 self._repo = repo
173 self._repo = repo
174
174
175 def baserevision(self, nodeorrev):
175 def baserevision(self, nodeorrev):
176 return filelog.filelog.revision(self, nodeorrev)
176 return filelog.filelog.revision(self, nodeorrev)
177
177
178 def baserevdiff(self, rev1, rev2):
178 def baserevdiff(self, rev1, rev2):
179 return filelog.filelog.revdiff(self, rev1, rev2)
179 return filelog.filelog.revdiff(self, rev1, rev2)
180
180
181 def iscensored(self, rev):
181 def iscensored(self, rev):
182 """Check if a revision is censored."""
182 """Check if a revision is censored."""
183 if rev <= self.repotiprev:
183 if rev <= self.repotiprev:
184 return filelog.filelog.iscensored(self, rev)
184 return filelog.filelog.iscensored(self, rev)
185 return self.revlog2.iscensored(rev)
185 node = self.node(rev)
186 return self.revlog2.iscensored(self.revlog2.rev(node))
186
187
187 class unionpeer(localrepo.localpeer):
188 class unionpeer(localrepo.localpeer):
188 def canpush(self):
189 def canpush(self):
189 return False
190 return False
190
191
191 class unionrepository(localrepo.localrepository):
192 class unionrepository(localrepo.localrepository):
192 def __init__(self, ui, path, path2):
193 def __init__(self, ui, path, path2):
193 localrepo.localrepository.__init__(self, ui, path)
194 localrepo.localrepository.__init__(self, ui, path)
194 self.ui.setconfig('phases', 'publish', False, 'unionrepo')
195 self.ui.setconfig('phases', 'publish', False, 'unionrepo')
195
196
196 self._url = 'union:%s+%s' % (util.expandpath(path),
197 self._url = 'union:%s+%s' % (util.expandpath(path),
197 util.expandpath(path2))
198 util.expandpath(path2))
198 self.repo2 = localrepo.localrepository(ui, path2)
199 self.repo2 = localrepo.localrepository(ui, path2)
199
200
200 @localrepo.unfilteredpropertycache
201 @localrepo.unfilteredpropertycache
201 def changelog(self):
202 def changelog(self):
202 return unionchangelog(self.svfs, self.repo2.svfs)
203 return unionchangelog(self.svfs, self.repo2.svfs)
203
204
204 def _clrev(self, rev2):
205 def _clrev(self, rev2):
205 """map from repo2 changelog rev to temporary rev in self.changelog"""
206 """map from repo2 changelog rev to temporary rev in self.changelog"""
206 node = self.repo2.changelog.node(rev2)
207 node = self.repo2.changelog.node(rev2)
207 return self.changelog.rev(node)
208 return self.changelog.rev(node)
208
209
209 @localrepo.unfilteredpropertycache
210 @localrepo.unfilteredpropertycache
210 def manifest(self):
211 def manifest(self):
211 return unionmanifest(self.svfs, self.repo2.svfs,
212 return unionmanifest(self.svfs, self.repo2.svfs,
212 self._clrev)
213 self._clrev)
213
214
214 def url(self):
215 def url(self):
215 return self._url
216 return self._url
216
217
217 def file(self, f):
218 def file(self, f):
218 return unionfilelog(self.svfs, f, self.repo2.svfs,
219 return unionfilelog(self.svfs, f, self.repo2.svfs,
219 self._clrev, self)
220 self._clrev, self)
220
221
221 def close(self):
222 def close(self):
222 self.repo2.close()
223 self.repo2.close()
223
224
224 def cancopy(self):
225 def cancopy(self):
225 return False
226 return False
226
227
227 def peer(self):
228 def peer(self):
228 return unionpeer(self)
229 return unionpeer(self)
229
230
230 def getcwd(self):
231 def getcwd(self):
231 return os.getcwd() # always outside the repo
232 return os.getcwd() # always outside the repo
232
233
233 def instance(ui, path, create):
234 def instance(ui, path, create):
234 if create:
235 if create:
235 raise error.Abort(_('cannot create new union repository'))
236 raise error.Abort(_('cannot create new union repository'))
236 parentpath = ui.config("bundle", "mainreporoot", "")
237 parentpath = ui.config("bundle", "mainreporoot", "")
237 if not parentpath:
238 if not parentpath:
238 # try to find the correct path to the working directory repo
239 # try to find the correct path to the working directory repo
239 parentpath = cmdutil.findrepo(os.getcwd())
240 parentpath = cmdutil.findrepo(os.getcwd())
240 if parentpath is None:
241 if parentpath is None:
241 parentpath = ''
242 parentpath = ''
242 if parentpath:
243 if parentpath:
243 # Try to make the full path relative so we get a nice, short URL.
244 # Try to make the full path relative so we get a nice, short URL.
244 # In particular, we don't want temp dir names in test outputs.
245 # In particular, we don't want temp dir names in test outputs.
245 cwd = os.getcwd()
246 cwd = os.getcwd()
246 if parentpath == cwd:
247 if parentpath == cwd:
247 parentpath = ''
248 parentpath = ''
248 else:
249 else:
249 cwd = pathutil.normasprefix(cwd)
250 cwd = pathutil.normasprefix(cwd)
250 if parentpath.startswith(cwd):
251 if parentpath.startswith(cwd):
251 parentpath = parentpath[len(cwd):]
252 parentpath = parentpath[len(cwd):]
252 if path.startswith('union:'):
253 if path.startswith('union:'):
253 s = path.split(":", 1)[1].split("+", 1)
254 s = path.split(":", 1)[1].split("+", 1)
254 if len(s) == 1:
255 if len(s) == 1:
255 repopath, repopath2 = parentpath, s[0]
256 repopath, repopath2 = parentpath, s[0]
256 else:
257 else:
257 repopath, repopath2 = s
258 repopath, repopath2 = s
258 else:
259 else:
259 repopath, repopath2 = parentpath, path
260 repopath, repopath2 = parentpath, path
260 return unionrepository(ui, repopath, repopath2)
261 return unionrepository(ui, repopath, repopath2)
@@ -1,150 +1,169 b''
1 Test unionrepo functionality
1 Test unionrepo functionality
2
2
3 Create one repository
3 Create one repository
4
4
5 $ hg init repo1
5 $ hg init repo1
6 $ cd repo1
6 $ cd repo1
7 $ touch repo1-0
7 $ touch repo1-0
8 $ echo repo1-0 > f
8 $ echo repo1-0 > f
9 $ hg ci -Aqmrepo1-0
9 $ hg ci -Aqmrepo1-0
10 $ touch repo1-1
10 $ touch repo1-1
11 $ echo repo1-1 >> f
11 $ echo repo1-1 >> f
12 $ hg ci -Aqmrepo1-1
12 $ hg ci -Aqmrepo1-1
13 $ touch repo1-2
13 $ touch repo1-2
14 $ echo repo1-2 >> f
14 $ echo repo1-2 >> f
15 $ hg ci -Aqmrepo1-2
15 $ hg ci -Aqmrepo1-2
16 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
16 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
17 2:68c0685446a3 repo1-2
17 2:68c0685446a3 repo1-2
18 1:8a58db72e69d repo1-1
18 1:8a58db72e69d repo1-1
19 0:f093fec0529b repo1-0
19 0:f093fec0529b repo1-0
20 $ tip1=`hg id -q`
20 $ tip1=`hg id -q`
21 $ cd ..
21 $ cd ..
22
22
23 - and a clone with a not-completely-trivial history
23 - and a clone with a not-completely-trivial history
24
24
25 $ hg clone -q repo1 --rev 0 repo2
25 $ hg clone -q repo1 --rev 0 repo2
26 $ cd repo2
26 $ cd repo2
27 $ touch repo2-1
27 $ touch repo2-1
28 $ sed '1i\
28 $ sed '1i\
29 > repo2-1 at top
29 > repo2-1 at top
30 > ' f > f.tmp
30 > ' f > f.tmp
31 $ mv f.tmp f
31 $ mv f.tmp f
32 $ hg ci -Aqmrepo2-1
32 $ hg ci -Aqmrepo2-1
33 $ touch repo2-2
33 $ touch repo2-2
34 $ hg pull -q ../repo1 -r 1
34 $ hg pull -q ../repo1 -r 1
35 $ hg merge -q
35 $ hg merge -q
36 $ hg ci -Aqmrepo2-2-merge
36 $ hg ci -Aqmrepo2-2-merge
37 $ touch repo2-3
37 $ touch repo2-3
38 $ echo repo2-3 >> f
38 $ echo repo2-3 >> f
39 $ hg ci -mrepo2-3
39 $ hg ci -mrepo2-3
40 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
40 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
41 4:2f0d178c469c repo2-3
41 4:2f0d178c469c repo2-3
42 3:9e6fb3e0b9da repo2-2-merge
42 3:9e6fb3e0b9da repo2-2-merge
43 2:8a58db72e69d repo1-1
43 2:8a58db72e69d repo1-1
44 1:c337dba826e7 repo2-1
44 1:c337dba826e7 repo2-1
45 0:f093fec0529b repo1-0
45 0:f093fec0529b repo1-0
46 $ cd ..
46 $ cd ..
47
47
48 revisions from repo2 appear as appended / pulled to repo1
48 revisions from repo2 appear as appended / pulled to repo1
49
49
50 $ hg -R union:repo1+repo2 log --template '{rev}:{node|short} {desc|firstline}\n'
50 $ hg -R union:repo1+repo2 log --template '{rev}:{node|short} {desc|firstline}\n'
51 5:2f0d178c469c repo2-3
51 5:2f0d178c469c repo2-3
52 4:9e6fb3e0b9da repo2-2-merge
52 4:9e6fb3e0b9da repo2-2-merge
53 3:c337dba826e7 repo2-1
53 3:c337dba826e7 repo2-1
54 2:68c0685446a3 repo1-2
54 2:68c0685446a3 repo1-2
55 1:8a58db72e69d repo1-1
55 1:8a58db72e69d repo1-1
56 0:f093fec0529b repo1-0
56 0:f093fec0529b repo1-0
57
57
58 manifest can be retrieved for revisions in both repos
58 manifest can be retrieved for revisions in both repos
59
59
60 $ hg -R union:repo1+repo2 mani -r $tip1
60 $ hg -R union:repo1+repo2 mani -r $tip1
61 f
61 f
62 repo1-0
62 repo1-0
63 repo1-1
63 repo1-1
64 repo1-2
64 repo1-2
65 $ hg -R union:repo1+repo2 mani -r 4
65 $ hg -R union:repo1+repo2 mani -r 4
66 f
66 f
67 repo1-0
67 repo1-0
68 repo1-1
68 repo1-1
69 repo2-1
69 repo2-1
70 repo2-2
70 repo2-2
71
71
72 files can be retrieved form both repos
72 files can be retrieved form both repos
73
73
74 $ hg -R repo1 cat repo1/f -r2
74 $ hg -R repo1 cat repo1/f -r2
75 repo1-0
75 repo1-0
76 repo1-1
76 repo1-1
77 repo1-2
77 repo1-2
78
78
79 $ hg -R union:repo1+repo2 cat -r$tip1 repo1/f
79 $ hg -R union:repo1+repo2 cat -r$tip1 repo1/f
80 repo1-0
80 repo1-0
81 repo1-1
81 repo1-1
82 repo1-2
82 repo1-2
83
83
84 $ hg -R union:repo1+repo2 cat -r4 $TESTTMP/repo1/f
84 $ hg -R union:repo1+repo2 cat -r4 $TESTTMP/repo1/f
85 repo2-1 at top
85 repo2-1 at top
86 repo1-0
86 repo1-0
87 repo1-1
87 repo1-1
88
88
89 files can be compared across repos
89 files can be compared across repos
90
90
91 $ hg -R union:repo1+repo2 diff -r$tip1 -rtip
91 $ hg -R union:repo1+repo2 diff -r$tip1 -rtip
92 diff -r 68c0685446a3 -r 2f0d178c469c f
92 diff -r 68c0685446a3 -r 2f0d178c469c f
93 --- a/f Thu Jan 01 00:00:00 1970 +0000
93 --- a/f Thu Jan 01 00:00:00 1970 +0000
94 +++ b/f Thu Jan 01 00:00:00 1970 +0000
94 +++ b/f Thu Jan 01 00:00:00 1970 +0000
95 @@ -1,3 +1,4 @@
95 @@ -1,3 +1,4 @@
96 +repo2-1 at top
96 +repo2-1 at top
97 repo1-0
97 repo1-0
98 repo1-1
98 repo1-1
99 -repo1-2
99 -repo1-2
100 +repo2-3
100 +repo2-3
101
101
102 heads from both repos are found correctly
102 heads from both repos are found correctly
103
103
104 $ hg -R union:repo1+repo2 heads --template '{rev}:{node|short} {desc|firstline}\n'
104 $ hg -R union:repo1+repo2 heads --template '{rev}:{node|short} {desc|firstline}\n'
105 5:2f0d178c469c repo2-3
105 5:2f0d178c469c repo2-3
106 2:68c0685446a3 repo1-2
106 2:68c0685446a3 repo1-2
107
107
108 revsets works across repos
108 revsets works across repos
109
109
110 $ hg -R union:repo1+repo2 id -r "ancestor($tip1, 5)"
110 $ hg -R union:repo1+repo2 id -r "ancestor($tip1, 5)"
111 8a58db72e69d
111 8a58db72e69d
112
112
113 annotate works - an indication that linkrevs works
113 annotate works - an indication that linkrevs works
114
114
115 $ hg --cwd repo1 -Runion:../repo2 annotate $TESTTMP/repo1/f -r tip
115 $ hg --cwd repo1 -Runion:../repo2 annotate $TESTTMP/repo1/f -r tip
116 3: repo2-1 at top
116 3: repo2-1 at top
117 0: repo1-0
117 0: repo1-0
118 1: repo1-1
118 1: repo1-1
119 5: repo2-3
119 5: repo2-3
120
120
121 union repos can be cloned ... and clones works correctly
121 union repos can be cloned ... and clones works correctly
122
122
123 $ hg clone -U union:repo1+repo2 repo3
123 $ hg clone -U union:repo1+repo2 repo3
124 requesting all changes
124 requesting all changes
125 adding changesets
125 adding changesets
126 adding manifests
126 adding manifests
127 adding file changes
127 adding file changes
128 added 6 changesets with 11 changes to 6 files (+1 heads)
128 added 6 changesets with 11 changes to 6 files (+1 heads)
129
129
130 $ hg -R repo3 paths
130 $ hg -R repo3 paths
131 default = union:repo1+repo2
131 default = union:repo1+repo2
132
132
133 $ hg -R repo3 verify
133 $ hg -R repo3 verify
134 checking changesets
134 checking changesets
135 checking manifests
135 checking manifests
136 crosschecking files in changesets and manifests
136 crosschecking files in changesets and manifests
137 checking files
137 checking files
138 6 files, 6 changesets, 11 total revisions
138 6 files, 6 changesets, 11 total revisions
139
139
140 $ hg -R repo3 heads --template '{rev}:{node|short} {desc|firstline}\n'
140 $ hg -R repo3 heads --template '{rev}:{node|short} {desc|firstline}\n'
141 5:2f0d178c469c repo2-3
141 5:2f0d178c469c repo2-3
142 2:68c0685446a3 repo1-2
142 2:68c0685446a3 repo1-2
143
143
144 $ hg -R repo3 log --template '{rev}:{node|short} {desc|firstline}\n'
144 $ hg -R repo3 log --template '{rev}:{node|short} {desc|firstline}\n'
145 5:2f0d178c469c repo2-3
145 5:2f0d178c469c repo2-3
146 4:9e6fb3e0b9da repo2-2-merge
146 4:9e6fb3e0b9da repo2-2-merge
147 3:c337dba826e7 repo2-1
147 3:c337dba826e7 repo2-1
148 2:68c0685446a3 repo1-2
148 2:68c0685446a3 repo1-2
149 1:8a58db72e69d repo1-1
149 1:8a58db72e69d repo1-1
150 0:f093fec0529b repo1-0
150 0:f093fec0529b repo1-0
151
152 union repos should use the correct rev number (issue5024)
153
154 $ hg init a
155 $ cd a
156 $ echo a0 >> f
157 $ hg ci -Aqm a0
158 $ cd ..
159 $ hg init b
160 $ cd b
161 $ echo b0 >> f
162 $ hg ci -Aqm b0
163 $ echo b1 >> f
164 $ hg ci -qm b1
165 $ cd ..
166
167 "hg files -v" to call fctx.size() -> fctx.iscensored()
168 $ hg files -R union:b+a -r2 -v
169 3 b/f (glob)
General Comments 0
You need to be logged in to leave comments. Login now