eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/histedit.py

changeset 7971
ff2971513d6d
parent 7970
c4ee8a81584c
child 8043
0acf98cd089a
child 8143
2c730d5fd177
equal deleted inserted replaced
7970:c4ee8a81584c 7971:ff2971513d6d
27 @param vcs reference to the Mercurial vcs object 27 @param vcs reference to the Mercurial vcs object
28 @type Hg 28 @type Hg
29 """ 29 """
30 super(Histedit, self).__init__(vcs) 30 super(Histedit, self).__init__(vcs)
31 31
32 def hgHisteditStart(self, name, rev=""): 32 def hgHisteditStart(self, rev=""):
33 """ 33 """
34 Public method to start a histedit session. 34 Public method to start a histedit session.
35 35
36 @param name file/directory name
37 @type str
38 @param rev revision to start histedit at 36 @param rev revision to start histedit at
39 @type str 37 @type str
40 @return flag indicating that the project should be reread 38 @return flag indicating that the project should be reread
41 @rtype bool 39 @rtype bool
42 """ 40 """
43 # find the root of the repo
44 repodir = self.vcs.splitPath(name)[0]
45 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
46 repodir = os.path.dirname(repodir)
47 if os.path.splitdrive(repodir)[1] == os.sep:
48 return False
49
50 from .HgHisteditConfigDialog import HgHisteditConfigDialog 41 from .HgHisteditConfigDialog import HgHisteditConfigDialog
51 res = False 42 res = False
52 dlg = HgHisteditConfigDialog(self.vcs.hgGetTagsList(), 43 dlg = HgHisteditConfigDialog(self.vcs.hgGetTagsList(),
53 self.vcs.hgGetBranchesList(), 44 self.vcs.hgGetBranchesList(),
54 self.vcs.hgGetBookmarksList(), 45 self.vcs.hgGetBookmarksList(),
74 65
75 dia = HgDialog( 66 dia = HgDialog(
76 self.tr("Starting histedit session"), 67 self.tr("Starting histedit session"),
77 self.vcs, 68 self.vcs,
78 useClient=False) 69 useClient=False)
79 res = dia.startProcess(args, repodir, environment=env) 70 res = dia.startProcess(args, environment=env)
80 if res: 71 if res:
81 dia.exec() 72 dia.exec()
82 res = dia.hasAddOrDelete() 73 res = dia.hasAddOrDelete()
83 self.vcs.checkVCSStatus() 74 self.vcs.checkVCSStatus()
84 return res 75 return res
85 76
86 def hgHisteditContinue(self, name): 77 def hgHisteditContinue(self):
87 """ 78 """
88 Public method to continue an interrupted histedit session. 79 Public method to continue an interrupted histedit session.
89 80
90 @param name file/directory name
91 @type str
92 @return flag indicating that the project should be reread 81 @return flag indicating that the project should be reread
93 @rtype bool 82 @rtype bool
94 """ 83 """
95 # find the root of the repo
96 repodir = self.vcs.splitPath(name)[0]
97 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
98 repodir = os.path.dirname(repodir)
99 if os.path.splitdrive(repodir)[1] == os.sep:
100 return False
101
102 args = self.vcs.initCommand("histedit") 84 args = self.vcs.initCommand("histedit")
103 args.append("--continue") 85 args.append("--continue")
104 args.append("-v") 86 args.append("-v")
105 87
106 editor = os.path.join( 88 editor = os.path.join(
109 91
110 dia = HgDialog( 92 dia = HgDialog(
111 self.tr("Continue histedit session"), 93 self.tr("Continue histedit session"),
112 self.vcs, 94 self.vcs,
113 useClient=False) 95 useClient=False)
114 res = dia.startProcess(args, repodir, environment=env) 96 res = dia.startProcess(args, environment=env)
115 if res: 97 if res:
116 dia.exec() 98 dia.exec()
117 res = dia.hasAddOrDelete() 99 res = dia.hasAddOrDelete()
118 self.vcs.checkVCSStatus() 100 self.vcs.checkVCSStatus()
119 return res 101 return res
125 @param name file/directory name 107 @param name file/directory name
126 @type str 108 @type str
127 @return flag indicating that the project should be reread 109 @return flag indicating that the project should be reread
128 @rtype bool 110 @rtype bool
129 """ 111 """
130 # find the root of the repo
131 repodir = self.vcs.splitPath(name)[0]
132 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
133 repodir = os.path.dirname(repodir)
134 if os.path.splitdrive(repodir)[1] == os.sep:
135 return False
136
137 args = self.vcs.initCommand("histedit") 112 args = self.vcs.initCommand("histedit")
138 args.append("--abort") 113 args.append("--abort")
139 args.append("-v") 114 args.append("-v")
140 115
141 editor = os.path.join( 116 editor = os.path.join(
144 119
145 dia = HgDialog( 120 dia = HgDialog(
146 self.tr("Abort histedit session"), 121 self.tr("Abort histedit session"),
147 self.vcs, 122 self.vcs,
148 useClient=False) 123 useClient=False)
149 res = dia.startProcess(args, repodir, environment=env) 124 res = dia.startProcess(args, environment=env)
150 if res: 125 if res:
151 dia.exec() 126 dia.exec()
152 res = dia.hasAddOrDelete() 127 res = dia.hasAddOrDelete()
153 self.vcs.checkVCSStatus() 128 self.vcs.checkVCSStatus()
154 return res 129 return res
155 130
156 def hgHisteditEditPlan(self, name): 131 def hgHisteditEditPlan(self):
157 """ 132 """
158 Public method to edit the remaining actions list of an interrupted 133 Public method to edit the remaining actions list of an interrupted
159 histedit session. 134 histedit session.
160 135
161 @param name file/directory name
162 @type str
163 @return flag indicating that the project should be reread 136 @return flag indicating that the project should be reread
164 @rtype bool 137 @rtype bool
165 """ 138 """
166 # find the root of the repo
167 repodir = self.vcs.splitPath(name)[0]
168 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
169 repodir = os.path.dirname(repodir)
170 if os.path.splitdrive(repodir)[1] == os.sep:
171 return False
172
173 args = self.vcs.initCommand("histedit") 139 args = self.vcs.initCommand("histedit")
174 args.append("--edit-plan") 140 args.append("--edit-plan")
175 args.append("-v") 141 args.append("-v")
176 142
177 editor = os.path.join( 143 editor = os.path.join(
180 146
181 dia = HgDialog( 147 dia = HgDialog(
182 self.tr("Edit Plan"), 148 self.tr("Edit Plan"),
183 self.vcs, 149 self.vcs,
184 useClient=False) 150 useClient=False)
185 res = dia.startProcess(args, repodir, environment=env) 151 res = dia.startProcess(args, environment=env)
186 if res: 152 if res:
187 dia.exec() 153 dia.exec()
188 res = dia.hasAddOrDelete() 154 res = dia.hasAddOrDelete()
189 self.vcs.checkVCSStatus() 155 self.vcs.checkVCSStatus()
190 return res 156 return res

eric ide

mercurial