##// END OF EJS Templates
context: add deprecation warnings for deprecated types of changeids...
Martin von Zweigbergk -
r37550:8475c9bf default
parent child Browse files
Show More
@@ -377,6 +377,30 b' class basectx(object):'
377 377
378 378 return r
379 379
380 def changectxdeprecwarn(repo):
381 # changectx's constructor will soon lose support for these forms of
382 # changeids:
383 # * stringinfied ints
384 # * bookmarks, tags, branches, and other namespace identifiers
385 # * hex nodeid prefixes
386 #
387 # Depending on your use case, replace repo[x] by one of these:
388 # * If you want to support general revsets, use scmutil.revsingle(x)
389 # * If you know that "x" is a stringified int, use repo[int(x)]
390 # * If you know that "x" is a bookmark, use repo._bookmarks.changectx(x)
391 # * If you know that "x" is a tag, use repo[repo.tags()[x]]
392 # * If you know that "x" is a branch or in some other namespace,
393 # use the appropriate mechanism for that namespace
394 # * If you know that "x" is a hex nodeid prefix, use
395 # repo[scmutil.resolvepartialhexnodeid(repo, x)]
396 # * If "x" is a string that can be any of the above, but you don't want
397 # to allow general revsets (perhaps because "x" may come from a remote
398 # user and the revset may be too costly), use scmutil.revsymbol(repo, x)
399 # * If "x" can be a mix of the above, you'll have to figure it out
400 # yourself
401 repo.ui.deprecwarn("changectx.__init__ is getting more limited, see source "
402 "for details", "4.6")
403
380 404 class changectx(basectx):
381 405 """A changecontext object makes access to data related to a particular
382 406 changeset convenient. It represents a read-only context already present in
@@ -426,6 +450,7 b' class changectx(basectx):'
426 450 raise ValueError
427 451 self._rev = r
428 452 self._node = repo.changelog.node(r)
453 changectxdeprecwarn(repo)
429 454 return
430 455 except error.FilteredIndexError:
431 456 raise
@@ -446,6 +471,7 b' class changectx(basectx):'
446 471 try:
447 472 self._node = repo.names.singlenode(repo, changeid)
448 473 self._rev = repo.changelog.rev(self._node)
474 changectxdeprecwarn(repo)
449 475 return
450 476 except KeyError:
451 477 pass
@@ -453,6 +479,7 b' class changectx(basectx):'
453 479 self._node = scmutil.resolvepartialhexnodeid(repo, changeid)
454 480 if self._node is not None:
455 481 self._rev = repo.changelog.rev(self._node)
482 changectxdeprecwarn(repo)
456 483 return
457 484
458 485 # lookup failed
General Comments 0
You need to be logged in to leave comments. Login now