Skip to content

Be less ambiguous when a project isn't under a VCS like Git or Mercurial #1224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/nimblepkg/packageparser.nim
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,12 @@ proc readPackageInfo(pkgInfo: var PackageInfo, nf: NimbleFile, options: Options,
## This version uses a cache stored in ``options``, so calling it multiple
## times on the same ``nf`` shouldn't require re-evaluation of the Nimble
## file.

assert fileExists(nf)

# Check the cache.
if options.pkgInfoCache.hasKey(nf):
pkgInfo = options.pkgInfoCache[nf]
return

pkgInfo = initPackageInfo(options, nf)
pkgInfo.isLink = not nf.startsWith(options.getPkgsDir)

Expand Down Expand Up @@ -397,7 +395,13 @@ proc readPackageInfo(pkgInfo: var PackageInfo, nf: NimbleFile, options: Options,
pkgInfo.metaData.specialVersions.incl pkgInfo.basicInfo.version
# If the `fileDir` is a VCS repository we can get some of the package meta
# data from it.
pkgInfo.metaData.vcsRevision = getVcsRevision(fileDir)
try:
pkgInfo.metaData.vcsRevision = getVcsRevision(fileDir)
except CatchableError:
raise nimbleError(
msg = "Failed to get VCS revision of your project!",
hint = "Try making a commit to your project if you haven't made one yet."
)

case getVcsType(fileDir)
of vcsTypeGit: pkgInfo.metaData.downloadMethod = DownloadMethod.git
Expand Down
2 changes: 1 addition & 1 deletion src/nimblepkg/syncfile.nim
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ proc getSyncFilePath(pkgInfo: PackageInfo): Path =
raise nimbleError(
msg = "Sync file require current working directory to be under some " &
"supported type of version control.",
hint = "Put package's working directory under version control.")
hint = "Put package's working directory under version control and create a commit to continue.")

return vcsSpecialDirPath / (pkgInfo.basicInfo.name & syncFileExt).Path

Expand Down
Loading