update master bookmark on pull

Summary:
update master bookmark on pull

update of the master bookmark normally uses fast path for most of the repos

pulling of bookmarks is the first thing the repo.pull implementation does, if
after that the commit is present in the repo, slow path pull won't be called

otherwise, we are calling slow path pull for fetching a chunk of main branch

if the clone is old, it is a long chunk, if there are merges, it gets even
more complicated for the slow path pull

the current version seems to have the issue with phases as well, then you restore snapshot from old clone, you got enormous smartlog.

Differential Revision: D46556754

fbshipit-source-id: a771a856813d513cd34b207ea76f1a410dc0b1c0
This commit is contained in:
Liubov Dmitrieva 2023-06-08 07:39:08 -07:00 committed by Facebook GitHub Bot
parent b29d1e2fbf
commit 19b1645eae
2 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,7 @@
from typing import Optional
from edenscm import error, scmutil
from edenscm import bookmarks, error, scmutil
from edenscm.cmdutil import changeset_printer, jsonchangeset
from edenscm.context import memctx, memfilectx
from edenscm.i18n import _
@ -25,7 +25,7 @@ def _snapshot2ctx(repo, snapshot) -> memctx:
assert isinstance(parent, bytes)
# Fetch parent if not present locally
if parent not in repo:
repo.pull(headnodes=(parent,))
repo.pull(bookmarknames=(bookmarks.mainbookmark(repo),), headnodes=(parent,))
parents = [repo[parent]]
path2filechange = {f[0]: f[1] for f in snapshot["file_changes"]}

View File

@ -5,7 +5,7 @@
import time
from edenscm import cmdutil, error, hg, perftrace, scmutil, util
from edenscm import bookmarks, cmdutil, error, hg, perftrace, scmutil, util
from edenscm.i18n import _
from .metalog import storelatest
@ -73,7 +73,9 @@ def _parent_update(ui, repo, parent) -> None:
# and needs pulling from server.
if parent not in repo:
with perftrace.trace("Parent pull"):
repo.pull(headnodes=(parent,))
repo.pull(
bookmarknames=(bookmarks.mainbookmark(repo),), headnodes=(parent,)
)
hg.updatetotally(ui, repo, parent, None, clean=False, updatecheck="abort")
duration = time.perf_counter() - start_parent_update