Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
a51622c3
Commit
a51622c3
authored
6 years ago
by
Simon Littlejohns
Committed by
Gav Wood
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added commit hash to --version (#489)
* Update config.rs * Update lib.rs
parent
d50d6b30
Branches
gh-readonly-queue/master/pr-6661-60146ba5d291530880e008e6650e2cfa74c9105c
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
substrate/substrate/cli/src/lib.rs
+4
-2
4 additions, 2 deletions
substrate/substrate/cli/src/lib.rs
substrate/substrate/service/src/config.rs
+8
-3
8 additions, 3 deletions
substrate/substrate/service/src/config.rs
with
12 additions
and
5 deletions
substrate/substrate/cli/src/lib.rs
+
4
−
2
View file @
a51622c3
...
...
@@ -44,7 +44,6 @@ extern crate exit_future;
#[macro_use]
extern
crate
lazy_static
;
#[macro_use]
extern
crate
clap
;
#[macro_use]
extern
crate
error_chain
;
...
...
@@ -164,6 +163,9 @@ where
{
panic_hook
::
set
();
let
full_version
=
service
::
Configuration
::
<<
F
>
::
Configuration
,
<
F
>
::
Genesis
>
::
full_version_from_strs
(
version
.version
,
version
.commit
);
let
yaml
=
format!
(
include_str!
(
"./cli.yml"
),
name
=
version
.executable_name
,
description
=
version
.description
,
...
...
@@ -171,7 +173,7 @@ where
);
let
yaml
=
&
clap
::
YamlLoader
::
load_from_str
(
&
yaml
)
.expect
(
"Invalid yml file"
)[
0
];
let
matches
=
match
clap
::
App
::
from_yaml
(
yaml
)
.version
(
&
(
crate
_version
!
()
.to_owned
()
+
"
\n
"
)[
..
])
.version
(
&
(
full
_version
+
"
\n
"
)[
..
])
.get_matches_from_safe
(
args
)
{
Ok
(
m
)
=>
m
,
Err
(
e
)
=>
e
.exit
(),
...
...
This diff is collapsed.
Click to expand it.
substrate/substrate/service/src/config.rs
+
8
−
3
View file @
a51622c3
...
...
@@ -105,10 +105,15 @@ impl<C: Default, G: Serialize + DeserializeOwned + BuildStorage> Configuration<C
format!
(
"{}-{}{}{}"
,
Target
::
arch
(),
Target
::
os
(),
env_dash
,
env
)
}
/// Returns full version string.
/// Returns full version string
of this configuration
.
pub
fn
full_version
(
&
self
)
->
String
{
let
commit_dash
=
if
self
.impl_commit
.is_empty
()
{
""
}
else
{
"-"
};
format!
(
"{}{}{}-{}"
,
self
.impl_version
,
commit_dash
,
self
.impl_commit
,
Self
::
platform
())
Self
::
full_version_from_strs
(
self
.impl_version
,
self
.impl_commit
)
}
/// Returns full version string, using supplied version and commit.
pub
fn
full_version_from_strs
(
impl_version
:
&
str
,
impl_commit
:
&
str
)
->
String
{
let
commit_dash
=
if
impl_commit
.is_empty
()
{
""
}
else
{
"-"
};
format!
(
"{}{}{}-{}"
,
impl_version
,
commit_dash
,
impl_commit
,
Self
::
platform
())
}
/// Implementation id and version.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment