Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 191
dccb19a7c52e
parent 189
17bb2db7a347
child 192
2c1187ab98ce
equal deleted inserted replaced
190:fe256eb3d19f 191:dccb19a7c52e
203 @param projectDir project directory (string) 203 @param projectDir project directory (string)
204 @param noDialog flag indicating quiet operations 204 @param noDialog flag indicating quiet operations
205 @return flag indicating an execution without errors (boolean) 205 @return flag indicating an execution without errors (boolean)
206 and a flag indicating the version controll status (boolean) 206 and a flag indicating the version controll status (boolean)
207 """ 207 """
208 ignorePatterns = [
209 "glob:.eric5project",
210 "glob:.ropeproject",
211 "glob:.directory",
212 "glob:**.pyc",
213 "glob:**.orig",
214 "glob:**.bak",
215 ]
216
217 msg = vcsDataDict["message"] 208 msg = vcsDataDict["message"]
218 if not msg: 209 if not msg:
219 msg = '***' 210 msg = '***'
220 211
221 args = [] 212 args = []
226 if res: 217 if res:
227 dia.exec_() 218 dia.exec_()
228 status = dia.normalExit() 219 status = dia.normalExit()
229 220
230 if status: 221 if status:
231 try: 222 status = self.hgCreateIgnoreFile(projectDir)
232 # create a .hgignore file
233 ignore = open(os.path.join(projectDir, ".hgignore"), "w")
234 ignore.write("\n".join(ignorePatterns))
235 ignore.close()
236 except IOError:
237 status = False
238 223
239 if status: 224 if status:
240 args = [] 225 args = []
241 args.append('commit') 226 args.append('commit')
242 args.append('--addremove') 227 args.append('--addremove')
1583 dia = HgDialog(self.trUtf8('Recovering from interrupted transaction')) 1568 dia = HgDialog(self.trUtf8('Recovering from interrupted transaction'))
1584 res = dia.startProcess(args, repodir, False) 1569 res = dia.startProcess(args, repodir, False)
1585 if res: 1570 if res:
1586 dia.exec_() 1571 dia.exec_()
1587 1572
1573 def hgCreateIgnoreFile(self, name, autoAdd = False):
1574 """
1575 Public method to create the ignore file.
1576
1577 @param name directory name to create the ignore file in (string)
1578 @param autoAdd flag indicating to add it automatically (boolean)
1579 @return flag indicating success
1580 """
1581 ignorePatterns = [
1582 "glob:.eric5project",
1583 "glob:.ropeproject",
1584 "glob:.directory",
1585 "glob:**.pyc",
1586 "glob:**.orig",
1587 "glob:**.bak",
1588 ]
1589
1590 ignoreName = os.path.join(name, ".hgignore")
1591 try:
1592 # create a .hgignore file
1593 ignore = open(ignoreName, "w")
1594 ignore.write("\n".join(ignorePatterns))
1595 ignore.write("\n")
1596 ignore.close()
1597 status = True
1598 except IOError:
1599 status = False
1600
1601 if status and autoAdd:
1602 self.vcsAdd(ignoreName, noDialog = True)
1603 project = e5App().getObject("Project")
1604 project.appendFile(ignoreName)
1605
1606 return status
1607
1588 ############################################################################ 1608 ############################################################################
1589 ## Methods to get the helper objects are below. 1609 ## Methods to get the helper objects are below.
1590 ############################################################################ 1610 ############################################################################
1591 1611
1592 def vcsGetProjectBrowserHelper(self, browser, project, isTranslationsBrowser = False): 1612 def vcsGetProjectBrowserHelper(self, browser, project, isTranslationsBrowser = False):

eric ide

mercurial