Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

stable settings, repowidget: add settings to select default widget and initial revision (closes #399)

Issue #399 proposes being able to let tortoisehg to select the working directory
when opening a repository.

This patch adds two new settings that not only allow configuring tortoisehg as
requested on issue #399, but also allow the user to select his preferred widget,
which can be any of the tortoisehg widgets (revision details, commit, manifest,
sync or search). This preferred widget is the one that will be selected by
default when opening a repository.

In addition, this patch adds a setting to select which revision should be
selected by default when opening a repository. It is possible to select the
current (i.e. the working directory parent) revision, the tip of the repository
or the working directory revision.

These two settings can be combined in interesting ways. For example it is
possible to make the commit widget the default while selecting the current
revision by default. It is also possible to make the working directory the
default and make the commit widget the default.

Note that when the working directory and the revision details widget are
selected by default, the commit widget will be selected instead.

Changeset 66aa04af1ab2

Parent bf5aeb1558df

by Angel Ezquerra

Changes to 2 files · Browse files at 66aa04af1ab2 Showing diff from parent bf5aeb1558df Diff from another changeset...

 
79
80
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
83
84
85
 
86
87
88
 
97
98
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
101
102
 
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
 
106
107
108
109
 
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
@@ -79,10 +79,31 @@
  self.basenode = None   self.destroyed.connect(self.repo.thginvalidate)   + # Determine the "initial revision" that must be shown when + # opening the repo. + # The "initial revision" can be selected via the settings, and it can + # have 3 possible values: + # - "current": Select the current (i.e. working dir parent) revision + # - "tip": Select tip of the repository + # - "workingdir": Select the working directory pseudo-revision + initialRevision= \ + self.repo.ui.config('tortoisehg', 'initialrevision', 'current').lower() + + initialRevisionDict = { + 'current': '.', + 'tip': 'tip', + 'workingdir': None + } + if initialRevision in initialRevisionDict: + default_rev = initialRevisionDict[initialRevision] + else: + # By default we'll select the current (i.e. working dir parent) revision + default_rev = '.' +   if repo.parents()[0].rev() == -1:   self._reload_rev = 'tip'   else: - self._reload_rev = '.' + self._reload_rev = default_rev   self.currentMessage = ''   self.dirty = False   @@ -97,6 +118,30 @@
  self.runner.makeLogVisible.connect(self.makeLogVisible)   self.runner.commandFinished.connect(self.onCommandFinished)   + # Select the widget chosen by the user + defaultWidget = \ + self.repo.ui.config( + 'tortoisehg', 'defaultwidget', 'revdetails').lower() + widgetDict = { + 'revdetails': self.logTabIndex, + 'commit': self.commitTabIndex, + 'mq': self.mqTabIndex, + 'sync': self.syncTabIndex, + 'manifest': self.manifestTabIndex, + 'search': self.grepTabIndex + } + if initialRevision == 'workingdir': + # Do not allow selecting the revision details widget when the + # selected revision is the working directory pseudo-revision + widgetDict['revdetails'] = self.commitTabIndex + + if defaultWidget in widgetDict: + widgetIndex = widgetDict[defaultWidget] + # Note: if the mq extension is not enabled, self.mqTabIndex will + # be negative + if widgetIndex > 0: + self.taskTabsWidget.setCurrentIndex(widgetIndex) +   def setupUi(self):   SP = QSizePolicy  
 
410
411
412
 
 
 
 
 
 
 
 
 
 
 
413
414
415
 
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
@@ -410,6 +410,17 @@
  )),    ({'name': 'log', 'label': _('Workbench'), 'icon': 'menulog'}, ( + _fi(_('Default widget'), 'tortoisehg.defaultwidget', (genDefaultCombo, + ['revdetails', 'commit', 'mq', 'sync', 'manifest', 'search']), + _('Select the initial widget that will be shown when opening a ' + 'repository. ' + 'Default: revdetails')), + _fi(_('Initial revision'), 'tortoisehg.initialrevision', (genDefaultCombo, + ['current', 'tip', 'workingdir']), + _('Select the initial revision that will be selected when opening a ' + 'repository. You can select the "current" (i.e. the working directory ' + 'parent), the current "tip" or the working directory ("workingdir"). ' + 'Default: current')),   _fi(_('Author Coloring'), 'tortoisehg.authorcolor', genBoolCombo,   _('Color changesets by author name. If not enabled, '   'the changes are colored green for merge, red for '