15 |
15 |
16 from ..HgExtension import HgExtension |
16 from ..HgExtension import HgExtension |
17 from ..HgDialog import HgDialog |
17 from ..HgDialog import HgDialog |
18 |
18 |
19 |
19 |
20 # TODO: Mercurial 4.7: add support for --confirm and --dry-run flags |
|
21 class Rebase(HgExtension): |
20 class Rebase(HgExtension): |
22 """ |
21 """ |
23 Class implementing the rebase extension interface. |
22 Class implementing the rebase extension interface. |
24 """ |
23 """ |
25 def __init__(self, vcs): |
24 def __init__(self, vcs): |
46 |
45 |
47 res = False |
46 res = False |
48 from .HgRebaseDialog import HgRebaseDialog |
47 from .HgRebaseDialog import HgRebaseDialog |
49 dlg = HgRebaseDialog(self.vcs.hgGetTagsList(repodir), |
48 dlg = HgRebaseDialog(self.vcs.hgGetTagsList(repodir), |
50 self.vcs.hgGetBranchesList(repodir), |
49 self.vcs.hgGetBranchesList(repodir), |
51 self.vcs.hgGetBookmarksList(repodir)) |
50 self.vcs.hgGetBookmarksList(repodir), |
|
51 self.vcs.version) |
52 if dlg.exec_() == QDialog.Accepted: |
52 if dlg.exec_() == QDialog.Accepted: |
53 (indicator, sourceRev, destRev, collapse, keep, keepBranches, |
53 (indicator, sourceRev, destRev, collapse, keep, keepBranches, |
54 detach) = dlg.getData() |
54 detach, dryRunOnly, dryRunConfirm) = dlg.getData() |
55 |
55 |
56 args = self.vcs.initCommand("rebase") |
56 args = self.vcs.initCommand("rebase") |
57 if indicator == "S": |
57 if indicator == "S": |
58 args.append("--source") |
58 args.append("--source") |
59 args.append(sourceRev) |
59 args.append(sourceRev) |
69 args.append("--keep") |
69 args.append("--keep") |
70 if keepBranches: |
70 if keepBranches: |
71 args.append("--keepbranches") |
71 args.append("--keepbranches") |
72 if detach: |
72 if detach: |
73 args.append("--detach") |
73 args.append("--detach") |
|
74 if dryRunOnly: |
|
75 args.append("--dry-run") |
|
76 elif dryRunConfirm: |
|
77 args.append("--confirm") |
74 args.append("--verbose") |
78 args.append("--verbose") |
75 |
79 |
76 dia = HgDialog(self.tr('Rebase Changesets'), self.vcs) |
80 dia = HgDialog(self.tr('Rebase Changesets'), self.vcs) |
77 res = dia.startProcess(args, repodir) |
81 res = dia.startProcess(args, repodir) |
78 if res: |
82 if res: |