Show More
@@ -134,54 +134,6 b' def reposetup(ui, repo):' | |||||
134 | return |
|
134 | return | |
135 |
|
135 | |||
136 | class bookmark_repo(repo.__class__): |
|
136 | class bookmark_repo(repo.__class__): | |
137 | def pull(self, remote, heads=None, force=False): |
|
|||
138 | result = super(bookmark_repo, self).pull(remote, heads, force) |
|
|||
139 |
|
||||
140 | self.ui.debug("checking for updated bookmarks\n") |
|
|||
141 | rb = remote.listkeys('bookmarks') |
|
|||
142 | changed = False |
|
|||
143 | for k in rb.keys(): |
|
|||
144 | if k in self._bookmarks: |
|
|||
145 | nr, nl = rb[k], self._bookmarks[k] |
|
|||
146 | if nr in self: |
|
|||
147 | cr = self[nr] |
|
|||
148 | cl = self[nl] |
|
|||
149 | if cl.rev() >= cr.rev(): |
|
|||
150 | continue |
|
|||
151 | if cr in cl.descendants(): |
|
|||
152 | self._bookmarks[k] = cr.node() |
|
|||
153 | changed = True |
|
|||
154 | self.ui.status(_("updating bookmark %s\n") % k) |
|
|||
155 | else: |
|
|||
156 | self.ui.warn(_("not updating divergent" |
|
|||
157 | " bookmark %s\n") % k) |
|
|||
158 | if changed: |
|
|||
159 | bookmarks.write(repo) |
|
|||
160 |
|
||||
161 | return result |
|
|||
162 |
|
||||
163 | def push(self, remote, force=False, revs=None, newbranch=False): |
|
|||
164 | result = super(bookmark_repo, self).push(remote, force, revs, |
|
|||
165 | newbranch) |
|
|||
166 |
|
||||
167 | self.ui.debug("checking for updated bookmarks\n") |
|
|||
168 | rb = remote.listkeys('bookmarks') |
|
|||
169 | for k in rb.keys(): |
|
|||
170 | if k in self._bookmarks: |
|
|||
171 | nr, nl = rb[k], hex(self._bookmarks[k]) |
|
|||
172 | if nr in self: |
|
|||
173 | cr = self[nr] |
|
|||
174 | cl = self[nl] |
|
|||
175 | if cl in cr.descendants(): |
|
|||
176 | r = remote.pushkey('bookmarks', k, nr, nl) |
|
|||
177 | if r: |
|
|||
178 | self.ui.status(_("updating bookmark %s\n") % k) |
|
|||
179 | else: |
|
|||
180 | self.ui.warn(_('updating bookmark %s' |
|
|||
181 | ' failed!\n') % k) |
|
|||
182 |
|
||||
183 | return result |
|
|||
184 |
|
||||
185 | def addchangegroup(self, *args, **kwargs): |
|
137 | def addchangegroup(self, *args, **kwargs): | |
186 | result = super(bookmark_repo, self).addchangegroup(*args, **kwargs) |
|
138 | result = super(bookmark_repo, self).addchangegroup(*args, **kwargs) | |
187 | if result > 1: |
|
139 | if result > 1: |
@@ -1301,26 +1301,50 b' class localrepository(repo.repository):' | |||||
1301 | common, fetch, rheads = tmp |
|
1301 | common, fetch, rheads = tmp | |
1302 | if not fetch: |
|
1302 | if not fetch: | |
1303 | self.ui.status(_("no changes found\n")) |
|
1303 | self.ui.status(_("no changes found\n")) | |
1304 |
re |
|
1304 | result = 0 | |
1305 |
|
1305 | else: | ||
1306 | if heads is None and fetch == [nullid]: |
|
1306 | if heads is None and fetch == [nullid]: | |
1307 | self.ui.status(_("requesting all changes\n")) |
|
1307 | self.ui.status(_("requesting all changes\n")) | |
1308 | elif heads is None and remote.capable('changegroupsubset'): |
|
1308 | elif heads is None and remote.capable('changegroupsubset'): | |
1309 | # issue1320, avoid a race if remote changed after discovery |
|
1309 | # issue1320, avoid a race if remote changed after discovery | |
1310 | heads = rheads |
|
1310 | heads = rheads | |
1311 |
|
1311 | |||
1312 | if heads is None: |
|
1312 | if heads is None: | |
1313 | cg = remote.changegroup(fetch, 'pull') |
|
1313 | cg = remote.changegroup(fetch, 'pull') | |
1314 | else: |
|
1314 | elif not remote.capable('changegroupsubset'): | |
1315 | if not remote.capable('changegroupsubset'): |
|
|||
1316 | raise util.Abort(_("partial pull cannot be done because " |
|
1315 | raise util.Abort(_("partial pull cannot be done because " | |
1317 | "other repository doesn't support " |
|
1316 | "other repository doesn't support " | |
1318 | "changegroupsubset.")) |
|
1317 | "changegroupsubset.")) | |
1319 | cg = remote.changegroupsubset(fetch, heads, 'pull') |
|
1318 | else: | |
1320 | return self.addchangegroup(cg, 'pull', remote.url(), lock=lock) |
|
1319 | cg = remote.changegroupsubset(fetch, heads, 'pull') | |
|
1320 | result = self.addchangegroup(cg, 'pull', remote.url(), | |||
|
1321 | lock=lock) | |||
1321 | finally: |
|
1322 | finally: | |
1322 | lock.release() |
|
1323 | lock.release() | |
1323 |
|
1324 | |||
|
1325 | self.ui.debug("checking for updated bookmarks\n") | |||
|
1326 | rb = remote.listkeys('bookmarks') | |||
|
1327 | changed = False | |||
|
1328 | for k in rb.keys(): | |||
|
1329 | if k in self._bookmarks: | |||
|
1330 | nr, nl = rb[k], self._bookmarks[k] | |||
|
1331 | if nr in self: | |||
|
1332 | cr = self[nr] | |||
|
1333 | cl = self[nl] | |||
|
1334 | if cl.rev() >= cr.rev(): | |||
|
1335 | continue | |||
|
1336 | if cr in cl.descendants(): | |||
|
1337 | self._bookmarks[k] = cr.node() | |||
|
1338 | changed = True | |||
|
1339 | self.ui.status(_("updating bookmark %s\n") % k) | |||
|
1340 | else: | |||
|
1341 | self.ui.warn(_("not updating divergent" | |||
|
1342 | " bookmark %s\n") % k) | |||
|
1343 | if changed: | |||
|
1344 | bookmarks.write(self) | |||
|
1345 | ||||
|
1346 | return result | |||
|
1347 | ||||
1324 | def checkpush(self, force, revs): |
|
1348 | def checkpush(self, force, revs): | |
1325 | """Extensions can override this function if additional checks have |
|
1349 | """Extensions can override this function if additional checks have | |
1326 | to be performed before pushing, or call it if they override push |
|
1350 | to be performed before pushing, or call it if they override push | |
@@ -1350,30 +1374,46 b' class localrepository(repo.repository):' | |||||
1350 | if not unbundle: |
|
1374 | if not unbundle: | |
1351 | lock = remote.lock() |
|
1375 | lock = remote.lock() | |
1352 | try: |
|
1376 | try: | |
1353 |
ret = discovery.prepush(self, remote, force, revs, |
|
1377 | cg, remote_heads = discovery.prepush(self, remote, force, revs, | |
1354 | if ret[0] is None: |
|
1378 | newbranch) | |
1355 | # and here we return 0 for "nothing to push" or 1 for |
|
1379 | ret = remote_heads | |
1356 | # "something to push but I refuse" |
|
1380 | if cg is not None: | |
1357 | return ret[1] |
|
1381 | if unbundle: | |
1358 |
|
1382 | # local repo finds heads on server, finds out what | ||
1359 | cg, remote_heads = ret |
|
1383 | # revs it must push. once revs transferred, if server | |
1360 | if unbundle: |
|
1384 | # finds it has different heads (someone else won | |
1361 | # local repo finds heads on server, finds out what revs it must |
|
1385 | # commit/push race), server aborts. | |
1362 | # push. once revs transferred, if server finds it has |
|
1386 | if force: | |
1363 | # different heads (someone else won commit/push race), server |
|
1387 | remote_heads = ['force'] | |
1364 | # aborts. |
|
1388 | # ssh: return remote's addchangegroup() | |
1365 | if force: |
|
1389 | # http: return remote's addchangegroup() or 0 for error | |
1366 |
re |
|
1390 | ret = remote.unbundle(cg, remote_heads, 'push') | |
1367 | # ssh: return remote's addchangegroup() |
|
1391 | else: | |
1368 | # http: return remote's addchangegroup() or 0 for error |
|
1392 | # we return an integer indicating remote head count change | |
1369 | return remote.unbundle(cg, remote_heads, 'push') |
|
1393 | ret = remote.addchangegroup(cg, 'push', self.url(), | |
1370 | else: |
|
1394 | lock=lock) | |
1371 | # we return an integer indicating remote head count change |
|
|||
1372 | return remote.addchangegroup(cg, 'push', self.url(), lock=lock) |
|
|||
1373 | finally: |
|
1395 | finally: | |
1374 | if lock is not None: |
|
1396 | if lock is not None: | |
1375 | lock.release() |
|
1397 | lock.release() | |
1376 |
|
1398 | |||
|
1399 | self.ui.debug("checking for updated bookmarks\n") | |||
|
1400 | rb = remote.listkeys('bookmarks') | |||
|
1401 | for k in rb.keys(): | |||
|
1402 | if k in self._bookmarks: | |||
|
1403 | nr, nl = rb[k], hex(self._bookmarks[k]) | |||
|
1404 | if nr in self: | |||
|
1405 | cr = self[nr] | |||
|
1406 | cl = self[nl] | |||
|
1407 | if cl in cr.descendants(): | |||
|
1408 | r = remote.pushkey('bookmarks', k, nr, nl) | |||
|
1409 | if r: | |||
|
1410 | self.ui.status(_("updating bookmark %s\n") % k) | |||
|
1411 | else: | |||
|
1412 | self.ui.warn(_('updating bookmark %s' | |||
|
1413 | ' failed!\n') % k) | |||
|
1414 | ||||
|
1415 | return ret | |||
|
1416 | ||||
1377 | def changegroupinfo(self, nodes, source): |
|
1417 | def changegroupinfo(self, nodes, source): | |
1378 | if self.ui.verbose or source == 'bundle': |
|
1418 | if self.ui.verbose or source == 'bundle': | |
1379 | self.ui.status(_("%d changesets found\n") % len(nodes)) |
|
1419 | self.ui.status(_("%d changesets found\n") % len(nodes)) |
@@ -141,6 +141,7 b' Extension disabled for lack of a hook' | |||||
141 | files: 3/3 chunks (100.00%) |
|
141 | files: 3/3 chunks (100.00%) | |
142 | added 3 changesets with 3 changes to 3 files |
|
142 | added 3 changesets with 3 changes to 3 files | |
143 | updating the branch cache |
|
143 | updating the branch cache | |
|
144 | checking for updated bookmarks | |||
144 | rolling back to revision 0 (undo push) |
|
145 | rolling back to revision 0 (undo push) | |
145 | 0:6675d58eff77 |
|
146 | 0:6675d58eff77 | |
146 |
|
147 | |||
@@ -219,6 +220,7 b' Extension disabled for lack of acl.sourc' | |||||
219 | calling hook pretxnchangegroup.acl: hgext.acl.hook |
|
220 | calling hook pretxnchangegroup.acl: hgext.acl.hook | |
220 | acl: changes have source "push" - skipping |
|
221 | acl: changes have source "push" - skipping | |
221 | updating the branch cache |
|
222 | updating the branch cache | |
|
223 | checking for updated bookmarks | |||
222 | rolling back to revision 0 (undo push) |
|
224 | rolling back to revision 0 (undo push) | |
223 | 0:6675d58eff77 |
|
225 | 0:6675d58eff77 | |
224 |
|
226 | |||
@@ -307,6 +309,7 b' No [acl.allow]/[acl.deny]' | |||||
307 | acl: branch access granted: "911600dab2ae" on branch "default" |
|
309 | acl: branch access granted: "911600dab2ae" on branch "default" | |
308 | acl: allowing changeset 911600dab2ae |
|
310 | acl: allowing changeset 911600dab2ae | |
309 | updating the branch cache |
|
311 | updating the branch cache | |
|
312 | checking for updated bookmarks | |||
310 | rolling back to revision 0 (undo push) |
|
313 | rolling back to revision 0 (undo push) | |
311 | 0:6675d58eff77 |
|
314 | 0:6675d58eff77 | |
312 |
|
315 | |||
@@ -941,6 +944,7 b' barney is allowed everywhere' | |||||
941 | acl: branch access granted: "911600dab2ae" on branch "default" |
|
944 | acl: branch access granted: "911600dab2ae" on branch "default" | |
942 | acl: allowing changeset 911600dab2ae |
|
945 | acl: allowing changeset 911600dab2ae | |
943 | updating the branch cache |
|
946 | updating the branch cache | |
|
947 | checking for updated bookmarks | |||
944 | rolling back to revision 0 (undo push) |
|
948 | rolling back to revision 0 (undo push) | |
945 | 0:6675d58eff77 |
|
949 | 0:6675d58eff77 | |
946 |
|
950 | |||
@@ -1336,6 +1340,7 b' acl.config can set only [acl.allow]/[acl' | |||||
1336 | acl: branch access granted: "911600dab2ae" on branch "default" |
|
1340 | acl: branch access granted: "911600dab2ae" on branch "default" | |
1337 | acl: allowing changeset 911600dab2ae |
|
1341 | acl: allowing changeset 911600dab2ae | |
1338 | updating the branch cache |
|
1342 | updating the branch cache | |
|
1343 | checking for updated bookmarks | |||
1339 | rolling back to revision 0 (undo push) |
|
1344 | rolling back to revision 0 (undo push) | |
1340 | 0:6675d58eff77 |
|
1345 | 0:6675d58eff77 | |
1341 |
|
1346 | |||
@@ -1432,6 +1437,7 b' fred is always allowed' | |||||
1432 | acl: branch access granted: "911600dab2ae" on branch "default" |
|
1437 | acl: branch access granted: "911600dab2ae" on branch "default" | |
1433 | acl: allowing changeset 911600dab2ae |
|
1438 | acl: allowing changeset 911600dab2ae | |
1434 | updating the branch cache |
|
1439 | updating the branch cache | |
|
1440 | checking for updated bookmarks | |||
1435 | rolling back to revision 0 (undo push) |
|
1441 | rolling back to revision 0 (undo push) | |
1436 | 0:6675d58eff77 |
|
1442 | 0:6675d58eff77 | |
1437 |
|
1443 | |||
@@ -1621,6 +1627,7 b' OS-level groups' | |||||
1621 | acl: branch access granted: "911600dab2ae" on branch "default" |
|
1627 | acl: branch access granted: "911600dab2ae" on branch "default" | |
1622 | acl: allowing changeset 911600dab2ae |
|
1628 | acl: allowing changeset 911600dab2ae | |
1623 | updating the branch cache |
|
1629 | updating the branch cache | |
|
1630 | checking for updated bookmarks | |||
1624 | rolling back to revision 0 (undo push) |
|
1631 | rolling back to revision 0 (undo push) | |
1625 | 0:6675d58eff77 |
|
1632 | 0:6675d58eff77 | |
1626 |
|
1633 |
@@ -104,13 +104,21 b' do not use the proxy if it is in the no ' | |||||
104 | * - - [*] "GET http://localhost:$HGPORT/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) |
|
104 | * - - [*] "GET http://localhost:$HGPORT/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) | |
105 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) |
|
105 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) | |
106 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
106 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) | |
|
107 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) | |||
|
108 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) | |||
107 | * - - [*] "GET http://localhost:$HGPORT/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) |
|
109 | * - - [*] "GET http://localhost:$HGPORT/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) | |
108 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) |
|
110 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) | |
109 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
111 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) | |
|
112 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) | |||
|
113 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) | |||
110 | * - - [*] "GET http://localhost:$HGPORT/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) |
|
114 | * - - [*] "GET http://localhost:$HGPORT/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) | |
111 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) |
|
115 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) | |
112 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
116 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) | |
|
117 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) | |||
|
118 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) | |||
113 | * - - [*] "GET http://localhost:$HGPORT/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) |
|
119 | * - - [*] "GET http://localhost:$HGPORT/?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between HTTP/1.1" - - (glob) | |
114 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) |
|
120 | * - - [*] "GET http://localhost:$HGPORT/?cmd=heads HTTP/1.1" - - (glob) | |
115 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) |
|
121 | * - - [*] "GET http://localhost:$HGPORT/?cmd=changegroup&roots=0000000000000000000000000000000000000000 HTTP/1.1" - - (glob) | |
|
122 | * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) | |||
|
123 | * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys&namespace=bookmarks HTTP/1.1" - - (glob) | |||
116 |
|
124 |
General Comments 0
You need to be logged in to leave comments.
Login now