Skip to content

Commit e145cc4

Browse files
committed
Add version 2, convert version 1 from days to hours automatically
1 parent 46b1759 commit e145cc4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ The file `.gitconsensus.yaml` needs to be placed in the repository to be managed
99
will be skipped.
1010

1111
```yaml
12+
# Which version of the consensus rules to use
13+
version: 2
1214

1315
# Add extra labels for the vote counts and age when merging
1416
extra_labels: false

gitconsensus/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ def reloadSettings():
1616
if os.path.isfile(path):
1717
with open(path, 'r') as f:
1818
settings = yaml.load(f)
19+
# support older versions by converting from day to hours.
20+
if 'version' not in settings or settings['version'] < 2:
21+
if 'mergedelay' in settings and settings['mergedelay']:
22+
settings['mergedelay'] = settings['mergedelay'] * 24
23+
if 'timeout' in settings and settings['timeout']:
24+
settings['timeout'] = settings['timeout'] * 24
1925
return settings
2026

2127

0 commit comments

Comments
 (0)