mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
use the lastest successor in phrevset
Summary: When user types Dxxx as a revset locally they usually mean the latest version of the commit - not neccesarily the one in phabricator. This usecase was usually handled by doing local lookup which can be very slow in case of slow commits: see for example those user complaints: https://fb.workplace.com/groups/scm/permalink/2487795837936688 Reviewed By: farnz Differential Revision: D18809252 fbshipit-source-id: b3442d6fa2ef9c9c0dff4909c874689810fbfa88
This commit is contained in:
parent
a1e20d2abf
commit
735a2fd691
@ -23,15 +23,13 @@ callsign = E
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import signal
|
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from edenscm.mercurial import error, hg, namespaces, pycompat, registrar, util
|
from edenscm.mercurial import error, hg, namespaces, pycompat, registrar, util
|
||||||
from edenscm.mercurial.i18n import _
|
from edenscm.mercurial.i18n import _
|
||||||
|
|
||||||
from .extlib.phabricator import arcconfig, diffprops, graphql
|
from .extlib.phabricator import graphql
|
||||||
|
|
||||||
|
|
||||||
configtable = {}
|
configtable = {}
|
||||||
@ -257,21 +255,19 @@ def revsetdiff(repo, diffid):
|
|||||||
# find their counterpart by parsing the log
|
# find their counterpart by parsing the log
|
||||||
results = set()
|
results = set()
|
||||||
for rev in revs:
|
for rev in revs:
|
||||||
# TODO: This really should be searching in repo.unfiltered(),
|
|
||||||
# and then resolving successors if the commit was hidden.
|
|
||||||
try:
|
try:
|
||||||
node = repo[rev.encode("utf-8")]
|
unfiltered = repo.unfiltered()
|
||||||
results.add(node.rev())
|
node = unfiltered[rev.encode("utf-8")]
|
||||||
except error.RepoLookupError:
|
except error.RepoLookupError:
|
||||||
repo.ui.warn(_("Commit not found - doing a linear search\n"))
|
raise error.Abort(
|
||||||
parsed_rev = finddiff(repo, diffid)
|
"Commit %s corresponding to D%s\n not found in the repo"
|
||||||
|
% (rev, diffid)
|
||||||
if not parsed_rev:
|
)
|
||||||
raise error.Abort(
|
successors = list(repo.revs("last(successors(%n))", node.node()))
|
||||||
"Could not find diff " "D%s in changelog" % diffid
|
if len(successors) != 1:
|
||||||
)
|
results.add(node.rev())
|
||||||
|
else:
|
||||||
results.add(parsed_rev)
|
results.add(successors[0])
|
||||||
|
|
||||||
if not results:
|
if not results:
|
||||||
raise error.Abort("Could not find local commit for D%s" % diffid)
|
raise error.Abort("Could not find local commit for D%s" % diffid)
|
||||||
@ -282,7 +278,7 @@ def revsetdiff(repo, diffid):
|
|||||||
if not vcs:
|
if not vcs:
|
||||||
msg = (
|
msg = (
|
||||||
"D%s does not have an associated version control system\n"
|
"D%s does not have an associated version control system\n"
|
||||||
"You can view the diff at http://phabricator.fb.com/D%s\n\n"
|
"You can view the diff at https:///our.internmc.facebook.com/intern/diff/D%s\n"
|
||||||
)
|
)
|
||||||
repo.ui.warn(msg % (diffid, diffid))
|
repo.ui.warn(msg % (diffid, diffid))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user