mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
d5544ee9c0
Summary: [sl] fix compatibility with PEP 440 Our current versioning schema isn't compatible with PEP 440. Luckily, changing the last `-` to a `+` works. Credit for the idea goes to ZhongRuoyu as mentioned in https://github.com/facebook/sapling/issues/598 Pull Request resolved: https://github.com/facebook/sapling/pull/606 Test Plan: - Ran `sl --version` to verify that it outputted a sane format (got `Sapling 0.2.20230417-165855+6db1e950`) - Verified that this was compliant with PEP 440: https://regex101.com/r/sv6aUZ/1 - Verified that this was compliant with Semver 2.0: https://regex101.com/r/RQsynA/1 - Also, verified that this was still compatible with Homebrew in a similar way to D42006425: ``` $ git --no-pager diff diff --git a/Library/Homebrew/test/version_spec.rb b/Library/Homebrew/test/version_spec.rb index 647fb5dcc..ac35b920a 100644 --- a/Library/Homebrew/test/version_spec.rb +++ b/Library/Homebrew/test/version_spec.rb @@ -841,6 +841,12 @@ describe Version do .to be_detected_from("https://opam.ocaml.org/archives/easy-format.1.0.2+opam.tar.gz") end + specify "sapling-better" do + expect(described_class.create("0.2.20230417-165855")) + .to be_detected_from("https://github.com/facebook/sapling/archive/refs/tags/0.2.20230417-165855+6db1e950.tar.gz") + end + + specify "no extension version" do expect(described_class.create("1.8.12")) .to be_detected_from("https://waf.io/waf-1.8.12") % ``` ``` $ ./bin/brew tests --only version -d -v Randomized with seed 48812 bundle exec parallel_rspec --nice -- -I /Users/sggutier/homebrew/Library/Homebrew/test --seed 48812 --color --require spec_helper --tag ~needs_linux --tag ~needs_network --tag ~needs_ci --tag ~needs_svn -- test/version_spec.rb test/version/parser_spec.rb 2 processes for 2 specs, ~ 1 spec per process ................... ..................................................................................................................... Took 2 seconds ``` --- Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/sapling/pull/606). * __->__ https://github.com/facebook/sapling/issues/606 * https://github.com/facebook/sapling/issues/605 Reviewed By: zzl0 Differential Revision: D45072716 Pulled By: sggutier fbshipit-source-id: 6fea731486e8b7ea4606a96b064dc3f724420649
18 lines
606 B
Bash
Executable File
18 lines
606 B
Bash
Executable File
#!/bin/bash
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
DIR=$(dirname -- "$0")
|
|
VERSION=$(<"$DIR"/../SAPLING_VERSION)
|
|
|
|
# Create the commit info using either sl or git, whichever way we cloned this repo
|
|
if ! command -v sl &> /dev/null; then
|
|
COMMIT_INFO=$(git -c "core.abbrev=8" show -s "--format=%cd+%h" "--date=format:%Y%m%d-%H%M%S")
|
|
else
|
|
COMMIT_INFO=$(sl log --rev . --template '{date(date, "%Y%m%d-%H%M%S")}+{shortest(node, 8)}')
|
|
fi
|
|
|
|
echo "$VERSION"."$COMMIT_INFO"
|