From 6aa5f2037759e14084b8a2fa37f5701153cbefeb Mon Sep 17 00:00:00 2001 From: ankitdobhal Date: Fri, 13 Mar 2020 19:33:45 +0530 Subject: [PATCH 1/7] Created newversion file --- container_workflow_tool/newversion.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 container_workflow_tool/newversion.py diff --git a/container_workflow_tool/newversion.py b/container_workflow_tool/newversion.py new file mode 100644 index 0000000..1021376 --- /dev/null +++ b/container_workflow_tool/newversion.py @@ -0,0 +1,3 @@ +#!/usr/bin/python3 +# newversion script with the help of Gitpython python. +from git import * From 28dedd627b7bedad75276ae162cbb1a4f76b01ef Mon Sep 17 00:00:00 2001 From: ankitdobhal Date: Thu, 26 Mar 2020 20:40:01 +0530 Subject: [PATCH 2/7] Updated newversion --- container_workflow_tool/newversion.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/container_workflow_tool/newversion.py b/container_workflow_tool/newversion.py index 1021376..5eb53e0 100644 --- a/container_workflow_tool/newversion.py +++ b/container_workflow_tool/newversion.py @@ -1,3 +1,21 @@ -#!/usr/bin/python3 -# newversion script with the help of Gitpython python. -from git import * +#! /usr/bin/python3 +# newversion command + +import subprocess as sub +from os import system +from re import findall +def create_newversion(_version): + system('tput setaf 2') + print('[*] Creating new version') + a=sub.call(['mkdir',_version]) + + +def move_version(_oldversion,_version): + create_newversion() + b=sub.call(['cp -r ',_oldversion,_version]) + sub.call(['rm -rf ',_oldversion,'/.git']) + + + + + \ No newline at end of file From 82e3be18dcae521b6fa3743d55cb1ae465190531 Mon Sep 17 00:00:00 2001 From: ankitdobhal Date: Fri, 10 Apr 2020 17:27:48 +0530 Subject: [PATCH 3/7] Added newversion function --- container_workflow_tool/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/container_workflow_tool/cli.py b/container_workflow_tool/cli.py index 85b2136..189e714 100755 --- a/container_workflow_tool/cli.py +++ b/container_workflow_tool/cli.py @@ -28,6 +28,10 @@ def koji_usage(self): def git_usage(self): return CliCommon.git_usage(self) % (self.prg_name, "") + + def newversion_usage(self): + return CliCommon.newversion_usage(self) % (self.prg_name, "") + def run(self): if self.args.command == "build": method_name = "build_images" From 6b3861dccbbc04a0b453a506858cb65ce8afee3a Mon Sep 17 00:00:00 2001 From: ankitdobhal Date: Fri, 10 Apr 2020 17:28:15 +0530 Subject: [PATCH 4/7] Added newversion command --- container_workflow_tool/constants.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/container_workflow_tool/constants.py b/container_workflow_tool/constants.py index 4f6d913..6c4c249 100644 --- a/container_workflow_tool/constants.py +++ b/container_workflow_tool/constants.py @@ -36,4 +36,9 @@ actions['dockerhub'] = ['updatefulldescription', ] actions['utils'] = ['showconfig', 'listimages', 'listupstream', ] +action_map['newversion'] = { +'add': 'add_new_version', +'show': 'show_changes', +} + COMMAND = "" From 95c381b4c605bd3d2fc3c4cd64bd27e2248a4065 Mon Sep 17 00:00:00 2001 From: ankitdobhal Date: Fri, 10 Apr 2020 17:28:37 +0530 Subject: [PATCH 5/7] Updated newversion file --- container_workflow_tool/newversion.py | 41 ++++++++++++++++----------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/container_workflow_tool/newversion.py b/container_workflow_tool/newversion.py index 5eb53e0..41a1e5c 100644 --- a/container_workflow_tool/newversion.py +++ b/container_workflow_tool/newversion.py @@ -1,21 +1,30 @@ -#! /usr/bin/python3 -# newversion command - +import os import subprocess as sub -from os import system -from re import findall -def create_newversion(_version): - system('tput setaf 2') - print('[*] Creating new version') - a=sub.call(['mkdir',_version]) +import shutil + +from git import Repo +from git.exc import GitCommandError + +class NewVersion(object,): + def __init__(self,_oldversion,_version): + self._oldversion=_oldversion + self._version=_version + + def create_newversion(_version): + system('tput setaf 2') + print('[*] Creating new version') + sub.call(['mkdir',self._version]) - -def move_version(_oldversion,_version): - create_newversion() - b=sub.call(['cp -r ',_oldversion,_version]) - sub.call(['rm -rf ',_oldversion,'/.git']) + def move_version(_oldversion,_version): + create_newversion() + sub.call(['git mv ',self._oldversion,self._version]) + sub.run(['git commit'],shell=true) - - \ No newline at end of file + def new_commit(_oldversion,_version): + move_version() + sub.call(['cp -r',self._version,self._oldversion]) + sub.call(['git add',self._version]) + sub.run(['git commit'],shell=true) + \ No newline at end of file From e995dfa58ecbe10d3c5f2e87dc2f0df0011024d1 Mon Sep 17 00:00:00 2001 From: ankitdobhal Date: Sat, 18 Apr 2020 16:40:46 +0530 Subject: [PATCH 6/7] Updated newversion --- container_workflow_tool/newversion.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/container_workflow_tool/newversion.py b/container_workflow_tool/newversion.py index 41a1e5c..9b425f7 100644 --- a/container_workflow_tool/newversion.py +++ b/container_workflow_tool/newversion.py @@ -10,21 +10,20 @@ def __init__(self,_oldversion,_version): self._oldversion=_oldversion self._version=_version - def create_newversion(_version): - system('tput setaf 2') - print('[*] Creating new version') - sub.call(['mkdir',self._version]) + def create_newversion(_version): + system('tput setaf 2') + sub.call(['mkdir',self._version]) - def move_version(_oldversion,_version): - create_newversion() - sub.call(['git mv ',self._oldversion,self._version]) - sub.run(['git commit'],shell=true) + def move_version(_oldversion,_version): + create_newversion() + sub.call(['git mv ',self._oldversion,self._version]) + sub.run(['git commit'],shell=true) - def new_commit(_oldversion,_version): - move_version() - sub.call(['cp -r',self._version,self._oldversion]) - sub.call(['git add',self._version]) - sub.run(['git commit'],shell=true) - \ No newline at end of file + def new_commit(_oldversion,_version): + move_version() + sub.call(['cp -r',self._version,self._oldversion]) + sub.call(['git add',self._version]) + sub.run(['git commit'],shell=true) + From 79c30bf85a810f0d7d88a4b349ddf8ea315bced2 Mon Sep 17 00:00:00 2001 From: ankitdobhal Date: Fri, 8 May 2020 18:06:02 +0530 Subject: [PATCH 7/7] Updated newversion Script --- container_workflow_tool/newversion.py | 39 ++++++++++++--------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/container_workflow_tool/newversion.py b/container_workflow_tool/newversion.py index 9b425f7..806722f 100644 --- a/container_workflow_tool/newversion.py +++ b/container_workflow_tool/newversion.py @@ -1,29 +1,24 @@ import os import subprocess as sub -import shutil +import sys -from git import Repo -from git.exc import GitCommandError +class NewVersion(object): + def __init__(self,_oldversion,_version): + self._oldversion=_oldversion + self._version=_version -class NewVersion(object,): - def __init__(self,_oldversion,_version): - self._oldversion=_oldversion - self._version=_version + def move(_oldversion,_version): + sub.Popen(['git','mv',_oldversion,_version],stdout=sub.PIPE) + sub.call('git commit -m "Added new version %s"'%_version,shell=True) - def create_newversion(_version): - system('tput setaf 2') - sub.call(['mkdir',self._version]) + def copyadd(_oldversion,_version): + sub.Popen(['cp','-r',_version,_oldversion],stdout=sub.PIPE) + sub.Popen(['git','add',_oldversion],stdout=sub.PIPE) + sub.call('git commit -m "Added old version %s"'%_oldversion,shell=True) - def move_version(_oldversion,_version): - create_newversion() - sub.call(['git mv ',self._oldversion,self._version]) - sub.run(['git commit'],shell=true) - - - def new_commit(_oldversion,_version): - move_version() - sub.call(['cp -r',self._version,self._oldversion]) - sub.call(['git add',self._version]) - sub.run(['git commit'],shell=true) - + if __name__ == '__main__': + _oldversion= sys.argv[1] + _version = sys.argv[2] + move(_oldversion,_version) + copyadd(_oldversion,_version) \ No newline at end of file