Skip to content

Commit

Permalink
FIXED age/retain regex to support yearly literal
Browse files Browse the repository at this point in the history
  • Loading branch information
masc3d committed May 16, 2016
1 parent 4a20e1c commit 7147593
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions btrfs_sxbackup/retention.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class Condition:
'y': timedelta(days=365),
'n': None}

__retain_re = re.compile('^([0-9]+)(/([0-9]+)?([hdwm]))?$', re.IGNORECASE)
__age_re = re.compile('^([0-9]+)([hdwm])?$', re.IGNORECASE)
__retain_re = re.compile('^([0-9]+)(/([0-9]+)?([hdwmy]))?$', re.IGNORECASE)
__age_re = re.compile('^([0-9]+)([hdwmy])?$', re.IGNORECASE)

def __init__(self, age: timedelta, interval_duration: timedelta, interval_amount: int, text: str):
self.__text = text
Expand Down
2 changes: 1 addition & 1 deletion btrfs_sxbackup/tests/TestKeepExpression.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def setUp(self):
self.snapshot_names = snapshot_names

def test_filter(self):
k = RetentionExpression('1d:4/d, 4d:daily, 1w:2/d, 1m:weekly, 12m:1/12m, 23m:none')
k = RetentionExpression('1d:4/d, 4d:daily, 1w:2/4d, 1m:weekly, 12m:1/y, 23m:none')
#k = KeepExpression('10')

start = time.perf_counter()
Expand Down

0 comments on commit 7147593

Please sign in to comment.