Fixed and Added.

This commit is contained in:
Saturneic 2019-03-13 16:00:26 +08:00
parent e988091cbe
commit 0a70306c97
2 changed files with 65 additions and 71 deletions

69
.idea/workspace.xml generated
View File

@ -2,13 +2,7 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="d703f139-38f3-455d-a086-a2da561870b5" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/branchmanager.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/change.py" beforeDir="false" afterPath="$PROJECT_DIR$/change.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/git.py" beforeDir="false" afterPath="$PROJECT_DIR$/git.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/info.py" beforeDir="false" afterPath="$PROJECT_DIR$/info.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/sshtool.py" beforeDir="false" afterPath="$PROJECT_DIR$/sshtool.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -42,7 +36,7 @@
<session id="46200952">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="1" />
<entry key="project.closed" value="2" />
<entry key="project.open.time.0" value="1" />
<entry key="project.open.time.16" value="1" />
<entry key="project.opened" value="2" />
@ -50,12 +44,12 @@
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="py" value="11673" />
<entry key="py" value="11693" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="Python" value="11673" />
<entry key="Python" value="11693" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
@ -72,11 +66,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/git.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="305" column="38" selection-start-line="305" selection-start-column="38" selection-end-line="305" selection-end-column="38" />
<state relative-caret-position="226">
<caret line="49" column="42" selection-start-line="49" selection-start-column="42" selection-end-line="49" selection-end-column="42" />
<folding>
<element signature="e#0#9#0" expanded="true" />
<marker date="1552453029448" expanded="true" signature="13269:13995" ph="..." />
@ -118,14 +112,14 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="194">
<caret line="274" column="33" selection-start-line="274" selection-start-column="33" selection-end-line="274" selection-end-column="33" />
<state relative-caret-position="104">
<caret line="73" column="16" lean-forward="true" selection-start-line="73" selection-start-column="16" selection-end-line="73" selection-end-column="16" />
<folding>
<element signature="e#0#21#0" expanded="true" />
<marker date="1552452986156" expanded="true" signature="15540:15546" ph="..." />
<marker date="1552453766451" expanded="true" signature="15701:15707" ph="..." />
</folding>
</state>
</provider>
@ -135,7 +129,7 @@
<entry file="file://$PROJECT_DIR$/info.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="27" lean-forward="true" selection-start-line="8" selection-start-column="27" selection-end-line="8" selection-end-column="27" />
<caret line="8" column="27" selection-start-line="8" selection-start-column="27" selection-end-line="8" selection-end-column="27" />
<folding>
<element signature="e#0#21#0" expanded="true" />
</folding>
@ -159,7 +153,7 @@
<entry file="file://$PROJECT_DIR$/sshtool.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-331">
<caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
<caret line="6" selection-start-line="6" selection-end-line="6" />
<folding>
<element signature="e#0#21#0" expanded="true" />
<marker date="1552409960112" expanded="true" signature="1144:1635" ph="..." />
@ -172,7 +166,7 @@
<entry file="file://$PROJECT_DIR$/branchmanager.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="66" column="24" lean-forward="true" selection-start-line="66" selection-start-column="24" selection-end-line="66" selection-end-column="24" />
<caret line="66" column="24" selection-start-line="66" selection-start-column="24" selection-end-line="66" selection-end-column="24" />
<folding>
<element signature="e#0#21#0" expanded="true" />
<marker date="1552415132051" expanded="true" signature="178:183" ph="..." />
@ -220,8 +214,8 @@
<option value="$PROJECT_DIR$/sshtool.py" />
<option value="$PROJECT_DIR$/info.py" />
<option value="$PROJECT_DIR$/branchmanager.py" />
<option value="$PROJECT_DIR$/main.py" />
<option value="$PROJECT_DIR$/git.py" />
<option value="$PROJECT_DIR$/main.py" />
</list>
</option>
</component>
@ -474,7 +468,6 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="811" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Favorites" order="0" side_tool="true" />
<window_info content_ui="combo" id="Project" order="1" visible="true" weight="0.14663805" />
@ -487,7 +480,7 @@
<window_info anchor="bottom" id="Docker" order="5" show_stripe_button="false" />
<window_info anchor="bottom" id="Message" order="6" />
<window_info anchor="bottom" id="Find" order="7" weight="0.329718" />
<window_info active="true" anchor="bottom" id="Run" order="8" sideWeight="0.49499285" visible="true" weight="0.2628651" />
<window_info anchor="bottom" id="Run" order="8" sideWeight="0.49499285" weight="0.2628651" />
<window_info anchor="bottom" id="Debug" order="9" sideWeight="0.49928468" weight="0.30737135" />
<window_info anchor="bottom" id="Cvs" order="10" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="11" weight="0.4" />
@ -548,7 +541,7 @@
<entry file="file://$PROJECT_DIR$/branchmanager.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="66" column="24" lean-forward="true" selection-start-line="66" selection-start-column="24" selection-end-line="66" selection-end-column="24" />
<caret line="66" column="24" selection-start-line="66" selection-start-column="24" selection-end-line="66" selection-end-column="24" />
<folding>
<element signature="e#0#21#0" expanded="true" />
<marker date="1552415132051" expanded="true" signature="178:183" ph="..." />
@ -582,7 +575,7 @@
<entry file="file://$PROJECT_DIR$/info.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="27" lean-forward="true" selection-start-line="8" selection-start-column="27" selection-end-line="8" selection-end-column="27" />
<caret line="8" column="27" selection-start-line="8" selection-start-column="27" selection-end-line="8" selection-end-column="27" />
<folding>
<element signature="e#0#21#0" expanded="true" />
</folding>
@ -602,7 +595,7 @@
<entry file="file://$PROJECT_DIR$/sshtool.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-331">
<caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" />
<caret line="6" selection-start-line="6" selection-end-line="6" />
<folding>
<element signature="e#0#21#0" expanded="true" />
<marker date="1552409960112" expanded="true" signature="1144:1635" ph="..." />
@ -610,21 +603,10 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="194">
<caret line="274" column="33" selection-start-line="274" selection-start-column="33" selection-end-line="274" selection-end-column="33" />
<folding>
<element signature="e#0#21#0" expanded="true" />
<marker date="1552452986156" expanded="true" signature="15540:15546" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/git.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="305" column="38" selection-start-line="305" selection-start-column="38" selection-end-line="305" selection-end-column="38" />
<state relative-caret-position="226">
<caret line="49" column="42" selection-start-line="49" selection-start-column="42" selection-end-line="49" selection-end-column="42" />
<folding>
<element signature="e#0#9#0" expanded="true" />
<marker date="1552453029448" expanded="true" signature="13269:13995" ph="..." />
@ -632,5 +614,16 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="104">
<caret line="73" column="16" lean-forward="true" selection-start-line="73" selection-start-column="16" selection-end-line="73" selection-end-column="16" />
<folding>
<element signature="e#0#21#0" expanded="true" />
<marker date="1552453766451" expanded="true" signature="15701:15707" ph="..." />
</folding>
</state>
</provider>
</entry>
</component>
</project>

67
main.py
View File

@ -70,44 +70,45 @@ class Main(window.Window):
self.do_connect()
def do_connect(self):
try:
self.git = git.Git(hostname=self.hostname.get(),
user=self.user_name.get(), passwd=self.password.get(),
path="/home/git/")
except paramiko.ssh_exception.AuthenticationException:
self.connection_status["text"] = "Failed"
showinfo(message="Authentication failed.")
return
if self.git is None:
try:
self.git = git.Git(hostname=self.hostname.get(),
user=self.user_name.get(), passwd=self.password.get(),
path="/home/git/")
except paramiko.ssh_exception.AuthenticationException:
self.connection_status["text"] = "Failed"
showinfo(message="Authentication failed.")
return
self.connection_status["text"] = "Succeed"
try:
self.git.base_init()
self.git.update_projects()
self.broad.insert(INSERT, "--------------------------\n")
self.broad.insert(INSERT, "SSH Connection [Succeed]\n")
self.broad.insert(INSERT, "Hostame: "+self.hostname.get()+"\n")
self.broad.insert(INSERT, "User: "+self.user_name.get()+"\n")
if self.save_info is not None:
self.git.set_local(self.save_info["local_path"])
self.broad.insert(INSERT, "Set Local Path...OK" + "\n")
self.local_path_label["text"] = "Local Path:"+self.save_info["local_path"]
self.connection_status["text"] = "Succeed"
try:
self.git.base_init()
self.git.update_projects()
self.git.list_projects()
if self.save_info["fix_project"]+".git" in self.git.projects_list:
self.broad.insert(INSERT, "--------------------------\n")
self.broad.insert(INSERT, "Auto Fix Project ({0})\n".format(self.save_info["fix_project"] + ".git"))
self.git.fix_project(self.save_info["fix_project"])
self.fix_local_plus()
self.broad.see(END)
self.fix_project_label["text"] = "Fixed Project: {0}".format(self.save_info["fix_project"])
self.broad.insert(INSERT, "--------------------------\n")
self.broad.insert(INSERT, "SSH Connection [Succeed]\n")
self.broad.insert(INSERT, "Hostame: "+self.hostname.get()+"\n")
self.broad.insert(INSERT, "User: "+self.user_name.get()+"\n")
if self.save_info is not None:
self.git.set_local(self.save_info["local_path"])
self.broad.insert(INSERT, "Set Local Path...OK" + "\n")
self.local_path_label["text"] = "Local Path:"+self.save_info["local_path"]
self.broad.see(END)
self.git.update_projects()
self.git.list_projects()
if self.save_info["fix_project"]+".git" in self.git.projects_list:
self.broad.insert(INSERT, "--------------------------\n")
self.broad.insert(INSERT, "Auto Fix Project ({0})\n".format(self.save_info["fix_project"] + ".git"))
self.git.fix_project(self.save_info["fix_project"])
self.fix_local_plus()
self.broad.see(END)
self.fix_project_label["text"] = "Fixed Project: {0}".format(self.save_info["fix_project"])
except AttributeError as errinfo:
showinfo(message=errinfo)
return
self.broad.see(END)
except AttributeError as errinfo:
showinfo(message=errinfo)
return
def do_list(self):
try: