Mercurial > hgsubversion
comparison hgsubversion/util.py @ 1555:cff81f35b31e
cleanup: reference Abort from mercurial.error instead of mercurial.util
It's been there since hg 1.7 or so, which lets us avoid any need for
compat shims.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sat, 24 Mar 2018 16:39:30 -0400 |
parents | 7f83be82d03f |
children | ae572c9be4e6 |
comparison
equal
deleted
inserted
replaced
1554:258fb67fb956 | 1555:cff81f35b31e |
---|---|
268 while (not sourcerev.node() in reverse_map | 268 while (not sourcerev.node() in reverse_map |
269 and sourcerev.node() != node.nullid): | 269 and sourcerev.node() != node.nullid): |
270 outgoing_rev_hashes.append(sourcerev.node()) | 270 outgoing_rev_hashes.append(sourcerev.node()) |
271 sourcerev = sourcerev.parents() | 271 sourcerev = sourcerev.parents() |
272 if len(sourcerev) != 1: | 272 if len(sourcerev) != 1: |
273 raise hgutil.Abort("Sorry, can't find svn parent of a merge revision.") | 273 raise error.Abort( |
274 "Sorry, can't find svn parent of a merge revision.") | |
274 sourcerev = sourcerev[0] | 275 sourcerev = sourcerev[0] |
275 if sourcerev.node() != node.nullid: | 276 if sourcerev.node() != node.nullid: |
276 return outgoing_rev_hashes | 277 return outgoing_rev_hashes |
277 | 278 |
278 def outgoing_common_and_heads(repo, reverse_map, sourcerev): | 279 def outgoing_common_and_heads(repo, reverse_map, sourcerev): |
285 sourcecx = repo[sourcerev] | 286 sourcecx = repo[sourcerev] |
286 while (not sourcecx.node() in reverse_map | 287 while (not sourcecx.node() in reverse_map |
287 and sourcecx.node() != node.nullid): | 288 and sourcecx.node() != node.nullid): |
288 ps = sourcecx.parents() | 289 ps = sourcecx.parents() |
289 if len(ps) != 1: | 290 if len(ps) != 1: |
290 raise hgutil.Abort("Sorry, can't find svn parent of a merge revision.") | 291 raise error.Abort( |
292 "Sorry, can't find svn parent of a merge revision.") | |
291 sourcecx = ps[0] | 293 sourcecx = ps[0] |
292 if sourcecx.node() != node.nullid: | 294 if sourcecx.node() != node.nullid: |
293 return ([sourcecx.node()], [sourcerev]) | 295 return ([sourcecx.node()], [sourcerev]) |
294 return ([sourcerev], [sourcerev]) # nothing outgoing | 296 return ([sourcerev], [sourcerev]) # nothing outgoing |
295 | 297 |
348 ''' | 350 ''' |
349 args = revset.getargs(x, 0, 0, "fromsvn takes no arguments") | 351 args = revset.getargs(x, 0, 0, "fromsvn takes no arguments") |
350 | 352 |
351 meta = repo.svnmeta(skiperrorcheck=True) | 353 meta = repo.svnmeta(skiperrorcheck=True) |
352 if not meta.revmapexists: | 354 if not meta.revmapexists: |
353 raise hgutil.Abort("svn metadata is missing - " | 355 raise error.Abort("svn metadata is missing - " |
354 "run 'hg svn rebuildmeta' to reconstruct it") | 356 "run 'hg svn rebuildmeta' to reconstruct it") |
355 tonode = repo.changelog.node | 357 tonode = repo.changelog.node |
356 hashes = meta.revmap.hashes() | 358 hashes = meta.revmap.hashes() |
357 return subset.filter(lambda r: tonode(r) in hashes) | 359 return subset.filter(lambda r: tonode(r) in hashes) |
358 | 360 |
359 def revset_svnrev(repo, subset, x): | 361 def revset_svnrev(repo, subset, x): |
369 except ValueError: | 371 except ValueError: |
370 raise error.ParseError("the argument to svnrev() must be a number") | 372 raise error.ParseError("the argument to svnrev() must be a number") |
371 | 373 |
372 meta = repo.svnmeta(skiperrorcheck=True) | 374 meta = repo.svnmeta(skiperrorcheck=True) |
373 if not meta.revmapexists: | 375 if not meta.revmapexists: |
374 raise hgutil.Abort("svn metadata is missing - " | 376 raise error.Abort("svn metadata is missing - " |
375 "run 'hg svn rebuildmeta' to reconstruct it") | 377 "run 'hg svn rebuildmeta' to reconstruct it") |
376 torev = repo.changelog.rev | 378 torev = repo.changelog.rev |
377 revs = revset.baseset(torev(r) for r in meta.revmap.revhashes(revnum)) | 379 revs = revset.baseset(torev(r) for r in meta.revmap.revhashes(revnum)) |
378 return subset & revs | 380 return subset & revs |
379 | 381 |
380 revsets = { | 382 revsets = { |