Skip to content

Comments

feat(build): Use git to set sl version number#522

Closed
vegerot wants to merge 2 commits intofacebook:mainfrom
vegerot:pr522
Closed

feat(build): Use git to set sl version number#522
vegerot wants to merge 2 commits intofacebook:mainfrom
vegerot:pr522

Conversation

@vegerot
Copy link
Contributor

@vegerot vegerot commented Feb 5, 2023

feat(build): Use git to set sl version number

Summary: When building Sapling using make oss, the version number is only set
to the date and commit when in an sl or hg repo. This commit adds the version
number when Sapling is cloned with git

Test plan:
$ git clone git@github.com:facebook/sapling.git

apply this patch

$ cd sapling/eden/scm
$ make oss
$ ./sl --version

On my machine:
Sapling 4.4.2_20230204-131549-hf454128c


Stack created with Sapling. Best reviewed with ReviewStack.

Summary: Currently, following the recommended documentation for building
Sapling will always set the sapling version to the upstream Mercurial version
(which has been 4.4.2 for years)

```sh
❯ sl --version
Sapling 4.4.2
```

This isn't very useful when debugging Sapling, and is inconsistenct with the
distributed versions of sl.  This commit aligns the sl version with the sl
version in the distributed versions of sl

Test Plan: manual

```sh
❯ (cd eden/scm && make oss && ./sl --version)
Sapling 0.2.20230107-190820-h75ace1ad
```
Summary: When building Sapling using `make oss`, the version number is only set
to the date and commit when in an sl or hg repo.  This commit adds the version
number when Sapling is cloned with git

Test plan:
```sh
$ git clone git@github.com:facebook/sapling.git
# apply this patch
$ cd sapling/eden/scm
$ make oss
$ ./sl --version
```

On my machine:
Sapling 4.4.2_20230204-131549-hf454128c
@facebook-github-bot
Copy link
Contributor

@quark-zju has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

# if hg is not found, fallback to a fixed version
out = hgtemplate(template) or ""
out = hgtemplate(template) or gitversion() or ""
# Some tools parse this number to figure out if they support this version of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this error out if the user has hg/sl installed and the current repo is a Git repo?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vegerot I was wrong about this causing issues. It should be fine given that hgtemplate returns an empty string instead of erroring out.

facebook-github-bot pushed a commit that referenced this pull request Feb 15, 2023
Summary:
(build): Use Sapling HEAD for sl version by default in `make oss`

 Currently, following the recommended documentation for building
Sapling will always set the sapling version to the upstream Mercurial version
(which has been 4.4.2 for years)

```sh
❯ sl --version
Sapling 4.4.2
```

This isn't very useful when debugging Sapling, and is inconsistenct with the
distributed versions of sl.  This commit aligns the sl version with the sl
version in the distributed versions of sl

Pull Request resolved: #440

Test Plan:
manual

```sh
❯ (cd eden/scm && make oss && ./sl --version)
Sapling 0.2.20230107-190820-h75ace1ad
```

 ---
Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/sapling/pull/440).
* #522
* __->__ #440

Reviewed By: sggutier

Differential Revision: D43329069

Pulled By: quark-zju

fbshipit-source-id: 26c39e652c5abd850a8ea28c206e7b4d8651a0e7
@facebook-github-bot
Copy link
Contributor

@quark-zju merged this pull request in dc84066.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants