Improve error msg that the project was not frozen

This change is trying to provide user more information
in case that he already froze project but date of last
freeze was not updated, since there were no changes for
last MAX_FROZEN_AGE days.

* Use osclib.freeze_command.MAX_FROZEN_AGE constant
* Avoid explicit proposal of --no-freeze bug suggest alternative
This commit is contained in:
Lubos Kocman 2019-04-12 13:43:38 +02:00
parent 0016e77e71
commit 082d37e36f
3 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import time
import re import re
from xml.etree import cElementTree as ET from xml.etree import cElementTree as ET
MAX_FROZEN_AGE = 6.5
class FreezeCommand(object): class FreezeCommand(object):

View File

@ -6,6 +6,7 @@ from osc import oscerr
from osc.core import http_GET from osc.core import http_GET
from osclib.request_finder import RequestFinder from osclib.request_finder import RequestFinder
from osclib.freeze_command import MAX_FROZEN_AGE
# from osclib.freeze_command import FreezeCommand # from osclib.freeze_command import FreezeCommand
@ -122,7 +123,8 @@ class SelectCommand(object):
# If the project is not frozen enough yet freeze it # If the project is not frozen enough yet freeze it
if not (no_freeze or self.api.prj_frozen_enough(self.target_project)): if not (no_freeze or self.api.prj_frozen_enough(self.target_project)):
print('Freeze the prj first') print('Project needs to be frozen or there was no change for last %d days.' % MAX_FROZEN_AGE)
print('Please freeze the project or use an option to ignore the time from the last freee.')
return False return False
# FreezeCommand(self.api).perform(self.target_project) # FreezeCommand(self.api).perform(self.target_project)

View File

@ -56,6 +56,7 @@ from osclib.core import source_file_load
from osclib.comments import CommentAPI from osclib.comments import CommentAPI
from osclib.ignore_command import IgnoreCommand from osclib.ignore_command import IgnoreCommand
from osclib.memoize import memoize from osclib.memoize import memoize
from osclib.freeze_command import MAX_FROZEN_AGE
class StagingAPI(object): class StagingAPI(object):
@ -1392,7 +1393,7 @@ class StagingAPI(object):
return True # already has content return True # already has content
# young enough # young enough
if self.days_since_last_freeze(project) < 6.5: if self.days_since_last_freeze(project) < MAX_FROZEN_AGE:
return True return True
return False return False