Fixes #436. Develop clones HEAD and full history.
This commit is contained in:
parent
225a0ef661
commit
d606867da6
3 changed files with 21 additions and 8 deletions
|
|
@ -1016,7 +1016,16 @@ proc develop(options: Options) =
|
|||
|
||||
let (meth, url, metadata) = getDownloadInfo(pv, options, true)
|
||||
let subdir = metadata.getOrDefault("subdir")
|
||||
discard downloadPkg(url, pv.ver, meth, subdir, options, downloadDir)
|
||||
|
||||
# Download the HEAD and make sure the full history is downloaded.
|
||||
let ver =
|
||||
if pv.ver.kind == verAny:
|
||||
parseVersionRange("#head")
|
||||
else:
|
||||
pv.ver
|
||||
var options = options
|
||||
options.forceFullClone = true
|
||||
discard downloadPkg(url, ver, meth, subdir, options, downloadDir)
|
||||
developFromDir(downloadDir / subdir, options)
|
||||
|
||||
proc test(options: Options) =
|
||||
|
|
|
|||
|
|
@ -42,17 +42,17 @@ proc doPull(meth: DownloadMethod, downloadDir: string) =
|
|||
doCmd("hg pull")
|
||||
|
||||
proc doClone(meth: DownloadMethod, url, downloadDir: string, branch = "",
|
||||
tip = true) =
|
||||
onlyTip = true) =
|
||||
case meth
|
||||
of DownloadMethod.git:
|
||||
let
|
||||
depthArg = if tip: "--depth 1 " else: ""
|
||||
depthArg = if onlyTip: "--depth 1 " else: ""
|
||||
branchArg = if branch == "": "" else: "-b " & branch & " "
|
||||
doCmd("git clone --recursive " & depthArg & branchArg & url &
|
||||
" " & downloadDir)
|
||||
of DownloadMethod.hg:
|
||||
let
|
||||
tipArg = if tip: "-r tip " else: ""
|
||||
tipArg = if onlyTip: "-r tip " else: ""
|
||||
branchArg = if branch == "": "" else: "-b " & branch & " "
|
||||
doCmd("hg clone " & tipArg & branchArg & url & " " & downloadDir)
|
||||
|
||||
|
|
@ -171,10 +171,11 @@ proc doDownload(url: string, downloadDir: string, verRange: VersionRange,
|
|||
if verRange.kind == verSpecial:
|
||||
# We want a specific commit/branch/tag here.
|
||||
if verRange.spe == getHeadName(downMethod):
|
||||
doClone(downMethod, url, downloadDir) # Grab HEAD.
|
||||
# Grab HEAD.
|
||||
doClone(downMethod, url, downloadDir, onlyTip = not options.forceFullClone)
|
||||
else:
|
||||
# Grab the full repo.
|
||||
doClone(downMethod, url, downloadDir, tip = false)
|
||||
doClone(downMethod, url, downloadDir, onlyTip = false)
|
||||
# Then perform a checkout operation to get the specified branch/commit.
|
||||
# `spe` starts with '#', trim it.
|
||||
doAssert(($verRange.spe)[0] == '#')
|
||||
|
|
@ -191,12 +192,13 @@ proc doDownload(url: string, downloadDir: string, verRange: VersionRange,
|
|||
getLatestByTag:
|
||||
display("Cloning", "latest tagged version: " & latest.tag,
|
||||
priority = MediumPriority)
|
||||
doClone(downMethod, url, downloadDir, latest.tag)
|
||||
doClone(downMethod, url, downloadDir, latest.tag,
|
||||
onlyTip = not options.forceFullClone)
|
||||
else:
|
||||
# If no commits have been tagged on the repo we just clone HEAD.
|
||||
doClone(downMethod, url, downloadDir) # Grab HEAD.
|
||||
of DownloadMethod.hg:
|
||||
doClone(downMethod, url, downloadDir)
|
||||
doClone(downMethod, url, downloadDir, onlyTip = not options.forceFullClone)
|
||||
result = getHeadName(downMethod)
|
||||
let versions = getTagsList(downloadDir, downMethod).getVersionList()
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ type
|
|||
showVersion*: bool
|
||||
noColor*: bool
|
||||
disableValidation*: bool
|
||||
## Whether packages' repos should always be downloaded with their history.
|
||||
forceFullClone*: bool
|
||||
|
||||
ActionType* = enum
|
||||
actionNil, actionRefresh, actionInit, actionDump, actionPublish,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue