You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2019/09/10 21:41:28 UTC
[openoffice] branch AOO42X updated: Set length of short git hash to
10
This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push:
new 997ab3c Set length of short git hash to 10
997ab3c is described below
commit 997ab3cdfc5a468c7c5f167587ae945afcd31832
Author: mseidel <ms...@apache.org>
AuthorDate: Tue Sep 10 23:37:12 2019 +0200
Set length of short git hash to 10
(cherry picked from commit 9b02d6736f880ca4d77732ed1dcb2275da3f1f67)
---
main/solenv/bin/modules/SvnRevision.pm | 84 +++++++++++++++++-----------------
1 file changed, 43 insertions(+), 41 deletions(-)
diff --git a/main/solenv/bin/modules/SvnRevision.pm b/main/solenv/bin/modules/SvnRevision.pm
index eab9538..81b811e 100644
--- a/main/solenv/bin/modules/SvnRevision.pm
+++ b/main/solenv/bin/modules/SvnRevision.pm
@@ -1,5 +1,5 @@
#**************************************************************
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,69 +7,71 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
#**************************************************************
+
+
package SvnRevision;
#old SVN code unchanged
sub DetectRevisionIdFromSVN ($)
{
- my $path = shift;
+ my $path = shift;
+
+ my $id = undef;
- my $id = undef;
-
- open my $proc, "cd $path && svn info 2>\&1 |";
- while (<$proc>)
- {
- if (/svn: E155007:/ || /svn: '.' is not a working copy/)
- {
- # Not in an SVN repository.
- $id = DetectRevisionIdFromGit($path);
- last;
- }
- else
- {
- if (/Last Changed Rev:\s+([0-9]+)/)
- {
- $id = $1;
- last;
- }
- }
- }
- close $proc;
+ open my $proc, "cd $path && svn info 2>\&1 |";
+ while (<$proc>)
+ {
+ if (/svn: E155007:/ || /svn: '.' is not a working copy/)
+ {
+ # Not in an SVN repository.
+ $id = DetectRevisionIdFromGit($path);
+ last;
+ }
+ else
+ {
+ if (/Last Changed Rev:\s+([0-9]+)/)
+ {
+ $id = $1;
+ last;
+ }
+ }
+ }
+ close $proc;
- return $id;
+ return $id;
}
sub DetectRevisionId ($)
{
- my $path = shift;
+ my $path = shift;
- my $id = undef;
- #test if path points to a git repository. if true return is 0 else positive number.
- my $isNotGit= `[ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1`;
- if ($isNotGit)
- {
- $id = DetectRevisionIdFromSVN ($path);
- }
- else
- {
- #returns directly the hash of the current checkout.
- $id = `git log -1 --pretty=format:%h`;
- }
+ my $id = undef;
+ #test if path points to a git repository. if true return is 0 else positive number.
+ my $isNotGit= `[ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1`;
+ if ($isNotGit)
+ {
+ $id = DetectRevisionIdFromSVN ($path);
+ }
+ else
+ {
+ #returns directly the hash of the current checkout.
+ $id = `git log -1 --pretty=format:%h --abbrev=10`;
+ }
- return $id;
+ return $id;
}
1;