25 |
23 |
26 @param vcs reference to the Mercurial vcs object |
24 @param vcs reference to the Mercurial vcs object |
27 """ |
25 """ |
28 super(Rebase, self).__init__(vcs) |
26 super(Rebase, self).__init__(vcs) |
29 |
27 |
30 def hgRebase(self, path): |
28 def hgRebase(self): |
31 """ |
29 """ |
32 Public method to rebase changesets to a different branch. |
30 Public method to rebase changesets to a different branch. |
33 |
31 |
34 @param path directory name of the project (string) |
|
35 @return flag indicating that the project should be reread (boolean) |
32 @return flag indicating that the project should be reread (boolean) |
36 """ |
33 """ |
37 # find the root of the repo |
|
38 repodir = self.vcs.splitPath(path)[0] |
|
39 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
40 repodir = os.path.dirname(repodir) |
|
41 if os.path.splitdrive(repodir)[1] == os.sep: |
|
42 return False |
|
43 |
|
44 res = False |
34 res = False |
45 from .HgRebaseDialog import HgRebaseDialog |
35 from .HgRebaseDialog import HgRebaseDialog |
46 dlg = HgRebaseDialog(self.vcs.hgGetTagsList(), |
36 dlg = HgRebaseDialog(self.vcs.hgGetTagsList(), |
47 self.vcs.hgGetBranchesList(), |
37 self.vcs.hgGetBranchesList(), |
48 self.vcs.hgGetBookmarksList(), |
38 self.vcs.hgGetBookmarksList(), |
74 elif dryRunConfirm: |
64 elif dryRunConfirm: |
75 args.append("--confirm") |
65 args.append("--confirm") |
76 args.append("--verbose") |
66 args.append("--verbose") |
77 |
67 |
78 dia = HgDialog(self.tr('Rebase Changesets'), self.vcs) |
68 dia = HgDialog(self.tr('Rebase Changesets'), self.vcs) |
79 res = dia.startProcess(args, repodir) |
69 res = dia.startProcess(args) |
80 if res: |
70 if res: |
81 dia.exec() |
71 dia.exec() |
82 res = dia.hasAddOrDelete() |
72 res = dia.hasAddOrDelete() |
83 self.vcs.checkVCSStatus() |
73 self.vcs.checkVCSStatus() |
84 return res |
74 return res |
85 |
75 |
86 def hgRebaseContinue(self, path): |
76 def hgRebaseContinue(self): |
87 """ |
77 """ |
88 Public method to continue rebasing changesets from another branch. |
78 Public method to continue rebasing changesets from another branch. |
89 |
79 |
90 @param path directory name of the project (string) |
|
91 @return flag indicating that the project should be reread (boolean) |
80 @return flag indicating that the project should be reread (boolean) |
92 """ |
81 """ |
93 # find the root of the repo |
|
94 repodir = self.vcs.splitPath(path)[0] |
|
95 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
96 repodir = os.path.dirname(repodir) |
|
97 if os.path.splitdrive(repodir)[1] == os.sep: |
|
98 return False |
|
99 |
|
100 args = self.vcs.initCommand("rebase") |
82 args = self.vcs.initCommand("rebase") |
101 args.append("--continue") |
83 args.append("--continue") |
102 args.append("--verbose") |
84 args.append("--verbose") |
103 |
85 |
104 dia = HgDialog(self.tr('Rebase Changesets (Continue)'), self.vcs) |
86 dia = HgDialog(self.tr('Rebase Changesets (Continue)'), self.vcs) |
105 res = dia.startProcess(args, repodir) |
87 res = dia.startProcess(args) |
106 if res: |
88 if res: |
107 dia.exec() |
89 dia.exec() |
108 res = dia.hasAddOrDelete() |
90 res = dia.hasAddOrDelete() |
109 self.vcs.checkVCSStatus() |
91 self.vcs.checkVCSStatus() |
110 return res |
92 return res |
111 |
93 |
112 def hgRebaseAbort(self, path): |
94 def hgRebaseAbort(self): |
113 """ |
95 """ |
114 Public method to abort rebasing changesets from another branch. |
96 Public method to abort rebasing changesets from another branch. |
115 |
97 |
116 @param path directory name of the project (string) |
|
117 @return flag indicating that the project should be reread (boolean) |
98 @return flag indicating that the project should be reread (boolean) |
118 """ |
99 """ |
119 # find the root of the repo |
|
120 repodir = self.vcs.splitPath(path)[0] |
|
121 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
122 repodir = os.path.dirname(repodir) |
|
123 if os.path.splitdrive(repodir)[1] == os.sep: |
|
124 return False |
|
125 |
|
126 args = self.vcs.initCommand("rebase") |
100 args = self.vcs.initCommand("rebase") |
127 args.append("--abort") |
101 args.append("--abort") |
128 args.append("--verbose") |
102 args.append("--verbose") |
129 |
103 |
130 dia = HgDialog(self.tr('Rebase Changesets (Abort)'), self.vcs) |
104 dia = HgDialog(self.tr('Rebase Changesets (Abort)'), self.vcs) |
131 res = dia.startProcess(args, repodir) |
105 res = dia.startProcess(args) |
132 if res: |
106 if res: |
133 dia.exec() |
107 dia.exec() |
134 res = dia.hasAddOrDelete() |
108 res = dia.hasAddOrDelete() |
135 self.vcs.checkVCSStatus() |
109 self.vcs.checkVCSStatus() |
136 return res |
110 return res |