hgext/narrow/narrowcommands.py
changeset 47012 d55b71393907
parent 46937 8e6911426b88
child 47025 124fe94016c0
equal deleted inserted replaced
46992:5fa019ceb499 47012:d55b71393907
    10 import os
    10 import os
    11 
    11 
    12 from mercurial.i18n import _
    12 from mercurial.i18n import _
    13 from mercurial.node import (
    13 from mercurial.node import (
    14     hex,
    14     hex,
    15     nullid,
       
    16     short,
    15     short,
    17 )
    16 )
    18 from mercurial import (
    17 from mercurial import (
    19     bundle2,
    18     bundle2,
    20     cmdutil,
    19     cmdutil,
   191     # we have all the nodes
   190     # we have all the nodes
   192     if wireprototypes.ELLIPSESCAP1 in pullop.remote.capabilities():
   191     if wireprototypes.ELLIPSESCAP1 in pullop.remote.capabilities():
   193         kwargs[b'known'] = [
   192         kwargs[b'known'] = [
   194             hex(ctx.node())
   193             hex(ctx.node())
   195             for ctx in repo.set(b'::%ln', pullop.common)
   194             for ctx in repo.set(b'::%ln', pullop.common)
   196             if ctx.node() != nullid
   195             if ctx.node() != repo.nullid
   197         ]
   196         ]
   198         if not kwargs[b'known']:
   197         if not kwargs[b'known']:
   199             # Mercurial serializes an empty list as '' and deserializes it as
   198             # Mercurial serializes an empty list as '' and deserializes it as
   200             # [''], so delete it instead to avoid handling the empty string on
   199             # [''], so delete it instead to avoid handling the empty string on
   201             # the server.
   200             # the server.
   368     with ui.uninterruptible():
   367     with ui.uninterruptible():
   369         if ellipsesremote:
   368         if ellipsesremote:
   370             ds = repo.dirstate
   369             ds = repo.dirstate
   371             p1, p2 = ds.p1(), ds.p2()
   370             p1, p2 = ds.p1(), ds.p2()
   372             with ds.parentchange():
   371             with ds.parentchange():
   373                 ds.setparents(nullid, nullid)
   372                 ds.setparents(repo.nullid, repo.nullid)
   374         if isoldellipses:
   373         if isoldellipses:
   375             with wrappedextraprepare:
   374             with wrappedextraprepare:
   376                 exchange.pull(repo, remote, heads=common)
   375                 exchange.pull(repo, remote, heads=common)
   377         else:
   376         else:
   378             known = []
   377             known = []
   379             if ellipsesremote:
   378             if ellipsesremote:
   380                 known = [
   379                 known = [
   381                     ctx.node()
   380                     ctx.node()
   382                     for ctx in repo.set(b'::%ln', common)
   381                     for ctx in repo.set(b'::%ln', common)
   383                     if ctx.node() != nullid
   382                     if ctx.node() != repo.nullid
   384                 ]
   383                 ]
   385             with remote.commandexecutor() as e:
   384             with remote.commandexecutor() as e:
   386                 bundle = e.callcommand(
   385                 bundle = e.callcommand(
   387                     b'narrow_widen',
   386                     b'narrow_widen',
   388                     {
   387                     {