• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Wirecloud / wirecloud / 8222080045

10 Mar 2024 12:46PM UTC coverage: 88.984%. Remained the same
8222080045

Pull #536

github

web-flow
Merge cf0349fc2 into 01e171aa3
Pull Request #536: Fix errors showing on console when Wirecloud is loaded as an iframe

7798 of 9095 branches covered (85.74%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

21194 of 23486 relevant lines covered (90.24%)

32.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

8.51
src/wirecloud/commons/utils/git.py
1
# -*- coding: utf-8 -*-
2

3
# Copyright (c) 2017 CoNWeT Lab., Universidad Politécnica de Madrid
4

5
# This file is part of Wirecloud.
6

7
# Wirecloud is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Affero General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11

12
# Wirecloud is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU Affero General Public License for more details.
16

17
# You should have received a copy of the GNU Affero General Public License
18
# along with Wirecloud.  If not, see <http://www.gnu.org/licenses/>.
19

20
import os
15✔
21
import subprocess
15✔
22

23
import wirecloud.platform
15✔
24

25

26
def get_git_info():
15✔
27
    def _minimal_ext_cmd(cmd):
×
28
        # construct minimal environment
29
        env = {}
×
30
        for k in ['SYSTEMROOT', 'PATH', 'HOME']:
×
31
            v = os.environ.get(k)
×
32
            if v is not None:
×
33
                env[k] = v
×
34
        # LANGUAGE is used on win32
35
        env['LANGUAGE'] = 'C'
×
36
        env['LANG'] = 'C'
×
37
        env['LC_ALL'] = 'C'
×
38
        out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
×
39
        return out
×
40

41
    # Check if this working copy is dirty
42
    try:
×
43
        out = _minimal_ext_cmd(['git', 'status', '--porcelain'])
×
44
        GIT_DIRTY = out.strip().decode('ascii').strip() != ""
×
45
    except OSError:
×
46
        GIT_DIRTY = True
×
47

48
    # Get current commit hash
49
    try:
×
50
        out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
×
51
        GIT_REVISION = out.strip().decode('ascii')
×
52
    except OSError:
×
53
        GIT_REVISION = "Unknown"
×
54

55
    # Check if HEAD points to a release commit
56
    IS_RELEASE = False
×
57
    release_tag = wirecloud.platform.__version__
×
58
    try:
×
59
        out = _minimal_ext_cmd(['git', 'tag', '-l', '--points-at', 'HEAD'])
×
60
        tags = out.strip().decode('ascii').splitlines()
×
61
        IS_RELEASE = release_tag in tags
×
62
    except OSError:
×
63
        pass
×
64

65
    # Provide a release date if this is a released version
66
    RELEASE_DATE = "Unknown"
×
67
    if IS_RELEASE and not GIT_DIRTY:
×
68
        try:
×
69
            out = _minimal_ext_cmd(['git', 'log', '-1', '--date=short', '--pretty=format:%cd'])
×
70
            RELEASE_DATE = out.strip().decode('ascii')
×
71
        except OSError:
×
72
            pass
×
73

74
    return GIT_REVISION, RELEASE_DATE, GIT_DIRTY
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc