refs #2705: fix commit message in image creation
parent
d4a6e09771
commit
090f6d3cf2
|
@ -35,7 +35,7 @@ class OgLogger(logging.StreamHandler):
|
|||
|
||||
|
||||
|
||||
def create_image(disk_num, partition_num, repo, image_name):
|
||||
def create_image(disk_num, partition_num, repo, image_name, commit_message):
|
||||
|
||||
ntfs_impl = NTFSImplementation.NTFS3G
|
||||
og_git = OpengnsysGitLibrary(ntfs_implementation = ntfs_impl)
|
||||
|
@ -45,7 +45,7 @@ def create_image(disk_num, partition_num, repo, image_name):
|
|||
if device is None:
|
||||
sys.exit(SystemLib.ogRaiseError([], ogGlobals.OG_ERR_FORMAT, f"Failed to translate disk {disk_num} partition {partition_num} to a device"))
|
||||
|
||||
if og_git.initRepo(device, image_name):
|
||||
if og_git.initRepo(device, image_name, message = commit_message):
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
@ -73,7 +73,7 @@ def main():
|
|||
parser.add_argument("--repository", type=str, metavar="REPO", required=True, help="Address of the Git repository to clone")
|
||||
parser.add_argument("--image-name", type=str, metavar="REPO", required=True, help="Name of the new image at the repository")
|
||||
parser.add_argument("--tag", type=str, metavar="TAG", required=False, help="Tag to automatically create")
|
||||
parser.add_argument("--message", type=str, metavar="MSG", required=False, help="Commit message")
|
||||
parser.add_argument("--message", type=str, metavar="MSG", required=False, default="", help="Commit message")
|
||||
|
||||
parser.add_help = True
|
||||
|
||||
|
@ -106,7 +106,7 @@ def main():
|
|||
# repo = repositorio, oggit@server.com:/oggit
|
||||
# image = nombre repo
|
||||
|
||||
retval = create_image(args.disk, args.partition, args.repository, args.image_name)
|
||||
retval = create_image(args.disk, args.partition, args.repository, args.image_name, args.message)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ def main():
|
|||
|
||||
parser.add_argument("--branch", type=str, metavar="BRANCH", required=False, help="Branch to automatically create")
|
||||
parser.add_argument("--options", type=str, metavar="OPTS", required=False, help="Options to branch creation (forcepush)")
|
||||
parser.add_argument("--message", type=str, metavar="MSG", required=False, help="Commit message")
|
||||
parser.add_argument("--message", type=str, metavar="MSG", required=False, default="", help="Commit message")
|
||||
|
||||
parser.add_help = True
|
||||
|
||||
|
|
|
@ -1254,7 +1254,7 @@ class OpengnsysGitLibrary:
|
|||
repo.config_writer().add_value("push", "followTags", "true").release()
|
||||
|
||||
|
||||
def initRepo(self, device, repo_name):
|
||||
def initRepo(self, device, repo_name, message = None):
|
||||
"""
|
||||
Initialize a Git repository on a specified device.
|
||||
|
||||
|
@ -1396,7 +1396,11 @@ class OpengnsysGitLibrary:
|
|||
|
||||
|
||||
self.logger.info("Committing")
|
||||
repo.index.commit("Initialize repository")
|
||||
|
||||
if message:
|
||||
repo.index.commit(message)
|
||||
else:
|
||||
repo.index.commit("Initialize repository")
|
||||
|
||||
# Restaurar cosas modificadas para git
|
||||
self._restore_metadata(path, destructive_only=True, set_device_uuids=False)
|
||||
|
|
Loading…
Reference in New Issue