-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
import bindings | ||
from edenscm import tracing | ||
|
||
from . import bookmarks as bookmod, error, identity, progress, util | ||
from . import bookmarks as bookmod, error, identity, progress, util, rcutil | ||
from .i18n import _ | ||
from .node import bin, hex, nullid | ||
|
||
|
@@ -153,6 +153,14 @@ def clone(ui, url, destpath=None, update=True, pullnames=None): | |
# If `git ls-remote --symref <url> HEAD` failed to yield a name, | ||
# fall back to the using the names in the config. | ||
pullnames = bookmod.selectivepullbookmarknames(repo) | ||
default_publicheads = repo.ui.config('remotenames', 'publicheads').split(',') | ||
# this is wrong when the remote HEAD is one of the defaults (or | ||
# no remote found), because it will duplicate remote/master | ||
remote_publicheads = ['remote/' + path for path in pullnames] | ||
all_publicheads = ','.join(default_publicheads+ remote_publicheads) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
strager
|
||
|
||
# TODO: .hg | ||
rcutil.editconfig(repo.ui, destpath + '/.sl/config', 'remotenames', 'publicheads', all_publicheads) | ||
|
||
# Make sure we pull "update". If it looks like a hash, add to | ||
# "nodes", otherwise to "names". | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,6 +260,7 @@ Test clone with flags (--noupdate, --updaterev): | |
remote/master 3f5848713286 | ||
$ cd .. | ||
|
||
#This test is VERY suspicious. It's supposed to test `ls-remote` symref HEAD parsing, but it passes `--updaterev` that totally circumvents all the code it's supposed to test | ||
$ hg clone --git "$TESTTMP/gitrepo" -u foo cloned1 | ||
From $TESTTMP/gitrepo | ||
* [new ref] 3f5848713286c67b8a71a450e98c7fa66787bde2 -> remote/master | ||
|
@@ -268,6 +269,15 @@ Test clone with flags (--noupdate, --updaterev): | |
$ hg --cwd cloned1 log -r . -T '{node|short} {remotenames} {desc}\n' | ||
57eda5013e06 remote/foo alpha3 | ||
|
||
$ (cd $TESTTMP/gitrepo && git switch foo) | ||
$ hg clone --git "$TESTTMP/gitrepo" cloned3 | ||
From $TESTTMP/gitrepo | ||
* [new ref] 3f5848713286c67b8a71a450e98c7fa66787bde2 -> remote/master | ||
* [new ref] 57eda5013e068ac543a52ad073cec3d7750113b5 -> remote/foo | ||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
$ hg --config publicheads | ||
remote/master,remote/foo | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
vegerot
Author
Owner
|
||
|
||
$ hg clone --updaterev foo --git "$TESTTMP/gitrepo" cloned2 | ||
From $TESTTMP/gitrepo | ||
* [new ref] 3f5848713286c67b8a71a450e98c7fa66787bde2 -> remote/master | ||
|
Easy solution to the duplicate problem: Use a set.
(I added
sorted
to make the output deterministic.)