Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

Merge with default

Changeset d86aa8c35b7a

Parents 29e6b36a9d91

Parents 554da6185638

by Yuki KODAMA

Changes to 12 files · Browse files at d86aa8c35b7a Showing diff from parent 29e6b36a9d91 554da6185638 Diff from another changeset...

 
46
47
48
 
49
50
51
52
53
 
46
47
48
49
50
 
51
52
53
@@ -46,8 +46,8 @@
 Name: hgbook; Description: The book 'Mercurial: The Definitive Guide' (PDF); Types: full    [Files] +Source: ..\build-hg\mercurial\help\*.txt; DestDir: {app}\help  Source: ..\build-hg\mercurial\templates\*.*; DestDir: {app}\templates; Flags: recursesubdirs createallsubdirs -Source: ..\build-hg\mercurial\help\*.txt; DestDir: {app}\help; Components: help  Source: ..\build-hg\mercurial\locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs  Source: ..\build-hg\i18n\*.*; DestDir: {app}\i18n  Source: ..\build-hg\doc\*.html; DestDir: {app}\docs; Flags: ignoreversion; Components: help
 
50
51
52
 
53
54
55
56
57
 
50
51
52
53
54
 
55
56
57
@@ -50,8 +50,8 @@
 Name: shell; Description: Shell integration (overlay icons, context menu) [admin required]; Types: full; Flags: restart; Check: ShellInstallPossible    [Files] +Source: ..\build-hg\mercurial\help\*.txt; DestDir: {app}\help  Source: ..\build-hg\mercurial\templates\*.*; DestDir: {app}\templates; Flags: recursesubdirs createallsubdirs -Source: ..\build-hg\mercurial\help\*.txt; DestDir: {app}\help; Components: help  Source: ..\build-hg\mercurial\locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs  Source: ..\build-hg\i18n\*.*; DestDir: {app}\i18n  Source: ..\build-hg\doc\*.html; DestDir: {app}\docs; Flags: ignoreversion; Components: help
 
14
15
16
17
 
18
19
20
 
26
27
28
 
29
30
31
 
39
40
41
 
 
 
42
43
44
 
 
45
46
47
 
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
82
83
84
 
 
 
 
 
 
85
86
 
 
 
87
88
89
 
106
107
108
 
 
 
 
 
 
 
 
 
 
 
 
109
110
111
112
 
 
 
113
114
115
 
121
122
123
 
124
125
126
 
130
131
132
133
 
 
 
 
134
135
136
 
138
139
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
142
143
 
155
156
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
159
160
 
256
257
258
 
 
 
 
 
 
 
 
 
 
259
260
261
 
14
15
16
 
17
18
19
20
 
26
27
28
29
30
31
32
 
40
41
42
43
44
45
46
47
 
48
49
50
51
52
 
72
73
74
 
 
 
 
 
 
 
 
 
 
 
75
76
77
78
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
110
111
112
113
 
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
 
160
161
162
163
164
165
166
 
170
171
172
 
173
174
175
176
177
178
179
 
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
 
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
 
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
@@ -14,7 +14,7 @@
 from hgext import bookmarks    from tortoisehg.util.i18n import _ -from tortoisehg.util import hglib, i18n +from tortoisehg.util import hglib, i18n, settings    from tortoisehg.hgtk import dialog, gtklib   @@ -26,6 +26,7 @@
 RESPONSE_REMOVE = 2  RESPONSE_RENAME = 3  RESPONSE_CURRENT = 4 +RESPONSE_MOVE = 5    class BookmarkDialog(gtk.Dialog):   """ Dialog to add bookmark to Mercurial repo """ @@ -39,9 +40,13 @@
    self.repo = repo   + # persistent settings + self.settings = settings.Settings('bookmark') +   # add buttons   if type == TYPE_ADDREMOVE: - self.add_button(_('Add'), RESPONSE_ADD) + self._button_add = self.add_button(_('Add'), RESPONSE_ADD) + self._button_move = self.add_button(_('Move'), RESPONSE_MOVE)   self.add_button(_('Remove'), RESPONSE_REMOVE)   elif type == TYPE_RENAME:   self.add_button(_('Rename'), RESPONSE_RENAME) @@ -67,23 +72,42 @@
  table.add_row(label, self._bookmarklistbox, padding=False)     ## add entry - entry = gtk.Entry() - if type == TYPE_ADDREMOVE: - self._rev_input = entry - entry.set_width_chars(12) - entry.set_text(rev) - label = _('Revision:') - elif type == TYPE_RENAME: - self._name_input = entry - label = _('New Name:') - table.add_row(label, entry, padding=False) - + if type == TYPE_CURRENT: + entry = None + else: + entry = gtk.Entry() + if type == TYPE_ADDREMOVE: + self._rev_input = entry + entry.set_width_chars(12) + entry.set_text(rev) + label = _('Revision:') + elif type == TYPE_RENAME: + self._name_input = entry + label = _('New Name:') + table.add_row(label, entry, padding=False) + + # Option to make new bookmark the active one + trackcurrent = self.repo.ui.configbool('bookmarks', 'track.current') + if type == TYPE_ADDREMOVE and trackcurrent: + check = gtk.CheckButton(_('Make new/moved bookmark current')) + self.opt_newcurrent = check + check.set_sensitive(hglib.is_rev_current(self.repo, rev)) + table.add_row(None, check) +   # signal handlers   self.connect('response', self.dialog_response)   self._bookmark_input.connect('activate', self.entry_activated, type) - entry.connect('activate', self.entry_activated, type) + if entry: + entry.connect('activate', self.entry_activated, type) + if type == TYPE_ADDREMOVE: + self._bookmark_input.connect('changed', self.bookmark_changed) + if trackcurrent: + self._rev_input.connect('changed', self.rev_changed)     # prepare to show + self.load_settings() + if type == TYPE_ADDREMOVE: + self.set_add_move_button_sensitivity()   self._refresh(clear=False)   if type == TYPE_RENAME:   self._name_input.grab_focus() @@ -106,10 +130,25 @@
  if clear:   self._bookmark_input.set_text('')   + def load_settings(self): + if hasattr(self, 'opt_newcurrent'): + newcurrent = self.settings.get_value('newcurrent', False) + self.opt_newcurrent.set_active(newcurrent) + + def store_settings(self): + if hasattr(self, 'opt_newcurrent'): + newcurrent = self.opt_newcurrent.get_active() + self.settings.set_value('newcurrent', newcurrent) + + self.settings.write() +   def dialog_response(self, dialog, response_id):   # Add button   if response_id == RESPONSE_ADD:   self._do_add_bookmark() + # Move button + elif response_id == RESPONSE_MOVE: + self._do_move_bookmark()   # Remove button   elif response_id == RESPONSE_REMOVE:   self._do_remove_bookmark() @@ -121,6 +160,7 @@
  self._do_current_bookmark()   # Close button or closed by the user   elif response_id in (gtk.RESPONSE_CLOSE, gtk.RESPONSE_DELETE_EVENT): + self.store_settings()   self.destroy()   return # close dialog   else: @@ -130,7 +170,10 @@
    def entry_activated(self, entry, type):   if type == TYPE_ADDREMOVE: - self.response(RESPONSE_ADD) + if self._button_add.get_property('sensitive'): + self.response(RESPONSE_ADD) + else: + self.response(RESPONSE_MOVE)   elif type == TYPE_RENAME:   self.response(RESPONSE_RENAME)   elif type == TYPE_CURRENT: @@ -138,6 +181,23 @@
  else:   raise _('unexpected type: %s') % type   + def rev_changed(self, rev_input): + rev = rev_input.get_text() + self.opt_newcurrent.set_sensitive(hglib.is_rev_current(self.repo, rev)) + + def bookmark_changed(self, bookmark_widget): + self.set_add_move_button_sensitivity() + + def set_add_move_button_sensitivity(self): + mark = self._bookmark_input.get_text() + if mark in hglib.get_repo_bookmarks(self.repo): + self._button_add.set_sensitive(False) + self._button_move.set_sensitive(True) + else: + self._button_add.set_sensitive(True) + self._button_move.set_sensitive(False) + +   def _do_add_bookmark(self):   # gather input data   name = self._bookmark_input.get_text() @@ -155,6 +215,40 @@
  self._add_hg_bookmark(name, rev)   dialog.info_dialog(self, _('Bookmarking completed'),   _('Bookmark "%s" has been added') % name) + if (hasattr(self, 'opt_newcurrent') and + self.opt_newcurrent.get_property('sensitive') and + self.opt_newcurrent.get_active()): + self._current_hg_bookmark(name) + self._refresh() + except util.Abort, inst: + dialog.error_dialog(self, _('Error in bookmarking'), str(inst)) + return False + except: + dialog.error_dialog(self, _('Error in bookmarking'), + traceback.format_exc()) + return False + + def _do_move_bookmark(self): + # gather input data + name = self._bookmark_input.get_text() + rev = self._rev_input.get_text() + + # verify input + if name == '': + dialog.error_dialog(self, _('Bookmark input is empty'), + _('Please enter bookmark name')) + self._bookmark_input.grab_focus() + return False + + # move bookmark + try: + self._move_hg_bookmark(name, rev) + dialog.info_dialog(self, _('Bookmarking completed'), + _('Bookmark "%s" has been moved') % name) + if (hasattr(self, 'opt_newcurrent') and + self.opt_newcurrent.get_property('sensitive') and + self.opt_newcurrent.get_active()): + self._current_hg_bookmark(name)   self._refresh()   except util.Abort, inst:   dialog.error_dialog(self, _('Error in bookmarking'), str(inst)) @@ -256,6 +350,16 @@
  rev=revision,   mark=name)   + def _move_hg_bookmark(self, name, revision): + if name not in hglib.get_repo_bookmarks(self.repo): + raise util.Abort(_('No bookmark named "%s" exists') % name) + + bookmarks.bookmark(ui=ui.ui(), + repo=self.repo, + rev=revision, + mark=name, + force=True) +   def _remove_hg_bookmark(self, name):   if not name in hglib.get_repo_bookmarks(self.repo):   raise util.Abort(_("Bookmark '%s' does not exist") % name)
 
159
160
161
 
162
163
164
 
201
202
203
204
 
205
206
207
 
210
211
212
213
 
214
215
216
 
252
253
254
255
 
 
256
257
258
 
 
259
260
 
261
262
263
 
264
265
266
 
159
160
161
162
163
164
165
 
202
203
204
 
205
206
207
208
 
211
212
213
 
214
215
216
217
 
253
254
255
 
256
257
258
259
 
260
261
262
 
263
264
265
 
266
267
268
269
@@ -159,6 +159,7 @@
  def chdir(self, cwd):   'change to a new directory'   # disable updates while we refill the model + self.cwd = cwd   model = self.get_model()   self.set_model(None)   model.clear() @@ -201,7 +202,7 @@
  if basename:   node = node.subdirs[basename]   adddir(node) - self.currepo = None + self.currepo = self.cachedrepo   else:   try:   for name in os.listdir(cwd): @@ -210,7 +211,7 @@
  except OSError:   # report to status bar   pass - self.currepo = self.cachedrepo + self.currepo = None       def cacherepo(self, root, pats=[], filetypes='CI?'): @@ -252,15 +253,17 @@
  model, tpaths = browse.get_selection().get_selected_rows()   if not tpaths:   return - files = [model[p][0] for p in tpaths if model[p][10]] + cpaths = [model[p][0] for p in tpaths] + files = []   if self.currepo:   repo = self.currepo - menus = self.menu.get_commands(repo, repo.root, files) + files = [os.path.join(self.cwd, p) for p in cpaths] + menus = self.menu.get_commands(repo, self.cwd, files)   else: - menus = self.menu.get_norepo_commands(None, files) + menus = self.menu.get_norepo_commands(None, cpaths)     def rundialog(item, hgcmd): - print 'rundialog', hgcmd, files + print 'rundialog', hgcmd, cpaths     def create_menu(label, hgcmd=None):   menuitem = gtk.MenuItem(label, True)
 
516
517
518
 
 
 
 
 
 
 
 
 
519
520
521
 
545
546
547
548
 
549
550
551
 
601
602
603
604
 
605
606
607
 
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
 
554
555
556
 
557
558
559
560
 
610
611
612
 
613
614
615
616
@@ -516,6 +516,15 @@
  return revline_data(tctx)   except (error.LookupError, error.RepoLookupError, error.RepoError):   return ts + elif item == 'p4': + ts = widget.get_data('p4', usepreset=True) + if not ts: + return None + try: + tctx = self.repo[ts] + return revline_data(tctx) + except (error.LookupError, error.RepoLookupError, error.RepoError): + return ts   elif item == 'patch':   if hasattr(ctx, '_patchname'):   desc = ctx.description() @@ -545,7 +554,7 @@
  if branch:   return '%s - %s %s' % (revnum, branch, summary)   return '%s - %s' % (revnum, summary) - if item in ('cset', 'transplant', 'patch'): + if item in ('cset', 'transplant', 'patch', 'p4'):   if isinstance(value, basestring):   return revid_markup(value)   return revline_markup(*value) @@ -601,7 +610,7 @@
  markup=markup_func, widget=widget_func)   self.csetstyle = csinfo.panelstyle(contents=('cset', 'branch',   'user', 'dateage', 'parents', 'children', - 'tags', 'transplant'), selectable=True) + 'tags', 'transplant', 'p4'), selectable=True)   self.patchstyle = csinfo.panelstyle(contents=('patch', 'branch',   'user', 'dateage', 'parents'),   selectable=True)
 
20
21
22
23
 
24
25
26
 
200
201
202
203
 
 
204
205
206
 
282
283
284
 
 
 
285
286
287
 
329
330
331
332
 
333
334
335
 
20
21
22
 
23
24
25
26
 
200
201
202
 
203
204
205
206
207
 
283
284
285
286
287
288
289
290
291
 
333
334
335
 
336
337
338
339
@@ -20,7 +20,7 @@
   from tortoisehg.hgtk import gtklib   -PANEL_DEFAULT = ('rev', 'summary', 'user', 'dateage', 'branch', 'tags', 'transplant') +PANEL_DEFAULT = ('rev', 'summary', 'user', 'dateage', 'branch', 'tags', 'transplant', 'p4')    def create(repo, target=None, style=None, custom=None, **kargs):   return Factory(repo, custom, style, target, **kargs)() @@ -200,7 +200,8 @@
  'user': _('User:'), 'date': _('Date:'),'age': _('Age:'),   'dateage': _('Date:'), 'branch': _('Branch:'),   'tags': _('Tags:'), 'rawbranch': _('Branch:'), - 'rawtags': _('Tags:'), 'transplant': _('Transplant:')} + 'rawtags': _('Tags:'), 'transplant': _('Transplant:'), + 'p4': _('Perforce:')}     def __init__(self):   pass @@ -282,6 +283,9 @@
  except KeyError:   pass   return None + elif item == 'p4': + extra = ctx.extra() + return extra.get('p4', None)   elif item == 'ishead':   return len(ctx.children()) == 0   raise UnknownItem(item) @@ -329,7 +333,7 @@
  return '%s' % revid   elif item in ('revid', 'transplant'):   return gtklib.markup(value, **mono) - elif item == 'revnum': + elif item in ('revnum', 'p4'):   return str(value)   elif item in ('rawbranch', 'branch'):   return gtklib.markup(' %s ' % value, color='black',
 
875
876
877
878
 
879
880
881
 
1047
1048
1049
 
 
 
1050
1051
1052
 
1117
1118
1119
 
1120
1121
1122
 
1213
1214
1215
 
 
 
1216
1217
1218
 
1912
1913
1914
1915
 
 
 
1916
1917
1918
1919
1920
1921
1922
 
 
1923
1924
1925
 
875
876
877
 
878
879
880
881
 
1047
1048
1049
1050
1051
1052
1053
1054
1055
 
1120
1121
1122
1123
1124
1125
1126
 
1217
1218
1219
1220
1221
1222
1223
1224
1225
 
1919
1920
1921
 
1922
1923
1924
1925
1926
1927
1928
1929
1930
 
1931
1932
1933
1934
1935
@@ -875,7 +875,7 @@
  m = gtklib.MenuItems()   m.append(create_menu(_('Add/Remove _Tag...'), self.add_tag))   if 'bookmarks' in self.exs: - m.append(create_menu(_('Add/Remove B_ookmark...'), + m.append(create_menu(_('Add/Move/Remove B_ookmark...'),   self.add_bookmark))   m.append(create_menu(_('Rename Bookmark...'),   self.rename_bookmark)) @@ -1047,6 +1047,9 @@
  self.syncbox = gtklib.SlimToolbar(self.tooltips)   syncbox = self.syncbox   + refresh = syncbox.append_stock(gtk.STOCK_REFRESH, + _('Reload revision history')) + syncbox.append_widget(gtk.VSeparator())   incoming = syncbox.append_stock(gtk.STOCK_GO_DOWN,   _('Download and view incoming changesets'))   apply = syncbox.append_stock(gtk.STOCK_APPLY, @@ -1117,6 +1120,7 @@
  _('Configure aliases and after pull behavior'))     ## connect syncbar buttons + refresh.connect('clicked', self.refresh_clicked)   incoming.connect('clicked', self.incoming_clicked)   pull.connect('clicked', self.pull_clicked)   outgoing.connect('clicked', self.outgoing_clicked) @@ -1213,6 +1217,9 @@
  return self.stbar     def refresh_on_marker_change(self, oldlen, oldmarkers, newmarkers): + # Note that oldmarkers/newmarkers may be either dicts + # (for add/remove bookmarks, which can also 'move' + # bookmarks), or lists (everything else)   self.repo.invalidate()   self.changeview.clear_cache()   if len(self.repo) != oldlen: @@ -1912,14 +1919,17 @@
    def add_bookmark(self, menuitem):   # save bookmark info for detecting new bookmarks added - oldbookmarks = hglib.get_repo_bookmarks(self.repo) + # since we can now move bookmarks, need to store + # the associated changesets as well + oldbookmarks = hglib.get_repo_bookmarks(self.repo, values=True)   oldlen = len(self.repo)   rev = str(self.currevid)   bmark = self.get_rev_tag(rev, include=oldbookmarks)     def refresh(*args):   self.refresh_on_marker_change(oldlen, oldbookmarks, - hglib.get_repo_bookmarks(self.repo)) + hglib.get_repo_bookmarks(self.repo, + values=True))     dialog = bookmark.BookmarkDialog(self.repo, bookmark.TYPE_ADDREMOVE,   bmark, rev)
 
70
71
72
73
74
 
75
76
77
 
82
83
84
85
86
87
88
89
90
 
70
71
72
 
 
73
74
75
76
 
81
82
83
 
 
 
84
85
86
@@ -70,8 +70,7 @@
  except error.RepoLookupError:   oldbranches = []   - repo.invalidate() - repo.dirstate.invalidate() + hglib.invalidaterepo(repo)     self.wcparents = [x.rev() for x in repo.parents()]   self.tagrevs = [repo[r].rev() for t, r in repo.tagslist()] @@ -82,9 +81,6 @@
  for rev in allrevs:   if rev in self.revisions:   del self.revisions[rev] - - if hasattr(self.repo, '_bookmarkcurrent'): - self.repo._bookmarkcurrent = None     def on_get_flags(self):   return gtk.TREE_MODEL_LIST_ONLY
 
54
55
56
57
58
 
 
59
60
61
 
80
81
82
83
 
84
85
86
 
99
100
101
102
 
103
104
105
106
 
107
108
109
 
54
55
56
 
 
57
58
59
60
61
 
80
81
82
 
83
84
85
86
 
99
100
101
 
102
103
104
105
 
106
107
108
109
@@ -54,8 +54,8 @@
    table = gtk.Table(2, 3)   cmframe.add(table) - def setcell(child, row, col): - table.attach(child, col, col + 1, row, row + 1, gtk.FILL|gtk.EXPAND, 0, 4, 2) + def setcell(child, row, col, xopts=gtk.FILL|gtk.EXPAND, yopts=0): + table.attach(child, col, col + 1, row, row + 1, xopts, yopts, 4, 2)   def withframe(widget):   scroll = gtk.ScrolledWindow()   scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) @@ -80,7 +80,7 @@
  cell = gtk.CellRendererText()   column.pack_start(cell, True)   column.add_attribute(cell, 'text', 1) - setcell(withframe(list), 1, 2) + setcell(withframe(list), 1, 2, yopts=gtk.FILL|gtk.EXPAND)     # Top menus pane   label = gtk.Label(_('Top menu items:')) @@ -99,11 +99,11 @@
  cell = gtk.CellRendererText()   column.pack_start(cell, True)   column.add_attribute(cell, 'text', 1) - setcell(withframe(list), 1, 0) + setcell(withframe(list), 1, 0, yopts=gtk.FILL|gtk.EXPAND)     # move buttons   mbbox = gtk.VBox() - setcell(mbbox, 1, 1) + setcell(mbbox, 1, 1, xopts=0, yopts=0)     topbutton = gtk.Button(_('<- Top'))   topbutton.connect('clicked', self.top_clicked)
 
68
69
70
 
 
 
 
 
71
72
73
 
121
122
123
 
124
 
125
126
127
 
128
 
129
130
131
 
184
185
186
 
 
187
188
189
 
68
69
70
71
72
73
74
75
76
77
78
 
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
 
193
194
195
196
197
198
199
200
@@ -68,6 +68,11 @@
  self.opt_merge = check   table.add_row(None, check)   + ## always show command log widget + showlog = gtk.CheckButton(_('Always show log')) + self.opt_showlog = showlog + table.add_row(None, showlog) +   ## fill list of combo   if rev != None:   combo.append_text(str(rev)) @@ -121,11 +126,15 @@
    def load_settings(self):   merge = self.settings.get_value('mergedefault', False) + showlog = self.settings.get_value('showlog', False)   self.opt_merge.set_active(merge) + self.opt_showlog.set_active(showlog)     def store_settings(self):   checked = self.opt_merge.get_active() + showlog = self.opt_showlog.get_active()   self.settings.set_value('mergedefault', checked) + self.settings.set_value('showlog', showlog)     self.settings.write()   @@ -184,6 +193,8 @@
  self.closebtn.set_property('visible', normal)   if cmd:   self.cmd.set_property('visible', working) + if self.opt_showlog.get_active(): + self.cmd.show_log()   self.abortbtn.set_property('visible', working)     def update_summaries(self):
 
120
121
122
 
 
123
124
125
 
235
236
237
238
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
121
122
123
124
125
126
127
 
237
238
239
 
 
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
 
@@ -120,6 +120,8 @@
  repo.invalidate()   if '_bookmarks' in repo.__dict__:   repo._bookmarks = {} + if hasattr(repo, '_bookmarkcurrent'): + repo._bookmarkcurrent = None   if 'mq' in repo.__dict__: #do not create if it does not exist   repo.mq.invalidate()   @@ -235,5 +237,25 @@
  return_path = path_aux   return return_path   -def get_repo_bookmarks(repo): - return repo._bookmarks.keys() +def get_repo_bookmarks(repo, values=False): + if values: + return dict(repo._bookmarks) + else: + return repo._bookmarks.keys() + +def is_rev_current(repo, rev): + ''' + Returns True if the revision indicated by 'rev' is the current + working directory parent. + + If rev is '' or None, it is assumed to mean 'tip'. + ''' + if rev in ('', None): + rev = 'tip' + rev = repo.lookup(rev) + parents = repo.parents() + + if len(parents) > 1: + return False + + return rev == parents[0].node() \ No newline at end of file
 
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
171
172
173
 
 
 
 
 
 
 
174
175
176
177
 
 
178
179
180
 
12
13
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
16
17
 
152
153
154
155
156
157
158
159
160
161
162
163
 
 
164
165
166
167
168
@@ -12,25 +12,6 @@
 from tortoisehg.util.i18n import _ as gettext  from tortoisehg.util import cachethg, paths, hglib   -promoted = [] -try: - from _winreg import HKEY_CURRENT_USER, OpenKey, QueryValueEx - try: - hkey = OpenKey(HKEY_CURRENT_USER, r"Software\TortoiseHg") - pl = QueryValueEx(hkey, 'PromotedItems')[0] - for item in pl.split(','): - item = item.strip() - if item: promoted.append(str(item)) - except EnvironmentError: - promoted = ['commit', 'log'] -except ImportError: - # fallback method for non-win32 platforms - u = ui.ui() - pl = u.config('tortoisehg', 'promoteditems', 'commit') - for item in pl.split(','): - item = item.strip() - if item: promoted.append(str(item)) -  def _(msgid):   return {'id': msgid, 'str': gettext(msgid)}   @@ -171,10 +152,17 @@
  self.ui = ui   self.name = name   self.sep = [False] + self.promoted = [] + pl = self.ui.config('tortoisehg', 'promoteditems', 'commit') + for item in pl.split(','): + item = item.strip() + if item: + self.promoted.append(str(item)) +     def add_menu(self, hgcmd, icon=None, state=True): - global promoted, thgcmenu - if hgcmd in promoted: + global thgcmenu + if hgcmd in self.promoted:   pos = 0   else:   pos = 1