Plugins/VcsPlugins/vcsMercurial/FetchExtension/fetch.py

changeset 5512
f148796813d4
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
equal deleted inserted replaced
5511:54632671aa3b 5512:f148796813d4
26 Constructor 26 Constructor
27 27
28 @param vcs reference to the Mercurial vcs object 28 @param vcs reference to the Mercurial vcs object
29 """ 29 """
30 super(Fetch, self).__init__(vcs) 30 super(Fetch, self).__init__(vcs)
31
32 self.__vcs = vcs
31 33
32 def hgFetch(self, name): 34 def hgFetch(self, name, revisions=None):
33 """ 35 """
34 Public method to fetch changes from a remote repository. 36 Public method to fetch changes from a remote repository.
35 37
36 @param name file/directory name (string) 38 @param name directory name of the project to be fetched to
37 @return flag indicating that the project should be reread (boolean) 39 @type str
40 @param revisions list of revisions to be pulled
41 @type list of str
42 @return flag indicating, that the update contained an add
43 or delete
44 @rtype bool
38 """ 45 """
39 # find the root of the repo 46 # find the root of the repo
40 repodir = self.vcs.splitPath(name)[0] 47 repodir = self.vcs.splitPath(name)[0]
41 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): 48 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
42 repodir = os.path.dirname(repodir) 49 repodir = os.path.dirname(repodir)
43 if os.path.splitdrive(repodir)[1] == os.sep: 50 if os.path.splitdrive(repodir)[1] == os.sep:
44 return False 51 return False
45 52
46 from .HgFetchDialog import HgFetchDialog 53 from .HgFetchDialog import HgFetchDialog
47 res = False 54 res = False
48 dlg = HgFetchDialog() 55 dlg = HgFetchDialog(self.__vcs)
49 if dlg.exec_() == QDialog.Accepted: 56 if dlg.exec_() == QDialog.Accepted:
50 message, switchParent = dlg.getData() 57 message, switchParent = dlg.getData()
51 58
52 args = self.vcs.initCommand("fetch") 59 args = self.vcs.initCommand("fetch")
53 if message != "": 60 if message != "":
54 args.append("--message") 61 args.append("--message")
55 args.append(message) 62 args.append(message)
56 if switchParent: 63 if switchParent:
57 args.append("--switch-parent") 64 args.append("--switch-parent")
58 args.append("-v") 65 args.append("-v")
66 if revisions:
67 for rev in revisions:
68 args.append("--rev")
69 args.append(rev)
59 70
60 dia = HgDialog( 71 dia = HgDialog(
61 self.tr('Fetching from a remote Mercurial repository'), 72 self.tr('Fetching from a remote Mercurial repository'),
62 self.vcs) 73 self.vcs)
63 res = dia.startProcess(args, repodir) 74 res = dia.startProcess(args, repodir)

eric ide

mercurial