Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

merge with stable

Changeset 350a863107ff

Parents 20e5bcf14e01

Parents 8c1d05232b74

by Steve Borho

Changes to 59 files · Browse files at 350a863107ff Showing diff from parent 20e5bcf14e01 8c1d05232b74 Diff from another changeset...

Change 1 of 1 Show Entire File contrib/​_hgtk Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
114
115
116
117
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
@@ -0,0 +1,552 @@
+#compdef hgtk + +# Zsh completion script for hgtk. +# copy it into your zsh function path (/usr/share/zsh/site-functions) +# +# Copyright (C) 2009 Steve Borho +# +# This is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your +# option) any later version. + +emulate -LR zsh +setopt extendedglob + +local curcontext="$curcontext" state line +typeset -A _hg_cmd_globals + +_hgtk() { + local cmd _hg_root + integer i=2 + _hg_cmd_globals=() + + while (( i < $#words )) + do + case "$words[$i]" in + -R|--repository) + eval _hg_root="$words[$i+1]" + _hg_cmd_globals+=("$words[$i]" "$_hg_root") + (( i += 2 )) + continue + ;; + -R*) + _hg_cmd_globals+="$words[$i]" + eval _hg_root="${words[$i]#-R}" + (( i++ )) + continue + ;; + --cwd|--config) + # pass along arguments to hg completer + _hg_cmd_globals+=("$words[$i]" "$words[$i+1]") + (( i += 2 )) + continue + ;; + -*) + # skip option + (( i++ )) + continue + ;; + esac + if [[ -z "$cmd" ]] + then + cmd="$words[$i]" + words[$i]=() + (( CURRENT-- )) + fi + (( i++ )) + done + + if [[ -z "$cmd" ]] + then + _arguments -s -w : $_hg_global_opts \ + ':hgtk command:_hg_commands' + return + fi + + # resolve abbreviations and aliases + if ! (( $+functions[_hg_cmd_${cmd}] )) + then + local cmdexp + (( $#_hg_cmd_list )) || _hg_get_commands + + cmdexp=$_hg_cmd_list[(r)${cmd}*] + if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]] + then + # might be nice to rewrite the command line with the expansion + cmd="$cmdexp" + fi + if [[ -n $_hg_alias_list[$cmd] ]] + then + cmd=$_hg_alias_list[$cmd] + fi + fi + + curcontext="${curcontext%:*:*}:hg-${cmd}:" + + zstyle -s ":completion:$curcontext:" cache-policy update_policy + + if [[ -z "$update_policy" ]] + then + zstyle ":completion:$curcontext:" cache-policy _hg_cache_policy + fi + + if (( $+functions[_hg_cmd_${cmd}] )) + then + _hg_cmd_${cmd} + else + # complete unknown commands normally + _arguments -s -w : $_hg_global_opts \ + '*:files:_hg_files' + fi +} + +_hg_cache_policy() { + typeset -a old + + # cache for a minute + old=( "$1"(mm+10) ) + (( $#old )) && return 0 + + return 1 +} + +_hg_get_commands() { + typeset -ga _hg_cmd_list + typeset -gA _hg_alias_list + local hline cmd cmdalias + + _call_program hgtk hgtk debugcomplete -v 2>/dev/null | while read -A hline + do + cmd=$hline[1] + _hg_cmd_list+=($cmd) + + for cmdalias in $hline[2,-1] + do + _hg_cmd_list+=($cmdalias) + _hg_alias_list+=($cmdalias $cmd) + done + done +} + +_hg_commands() { + (( $#_hg_cmd_list )) || _hg_get_commands + _describe -t commands 'hgtk command' _hg_cmd_list +} + +_hg_revrange() { + compset -P 1 '*:' + _hg_tags "$@" +} + +_hg_tags() { + typeset -a tags + local tag rev + + _hg_cmd tags 2> /dev/null | while read tag + do + tags+=(${tag/ # [0-9]#:*}) + done + (( $#tags )) && _describe -t tags 'tags' tags +} + +_hg_files() { + if [[ -n "$_hg_root" ]] + then + [[ -d "$_hg_root/.hg" ]] || return + case "$_hg_root" in + /*) + _files -W $_hg_root + ;; + *) + _files -W $PWD/$_hg_root + ;; + esac + else + _files + fi +} + +_hg_status() { + [[ -d $PREFIX ]] || PREFIX=$PREFIX:h + status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX 2>/dev/null)"}) +} + +_hg_unknown() { + typeset -a status_files + _hg_status u + _wanted files expl 'unknown files' _multi_parts / status_files +} + +_hg_missing() { + typeset -a status_files + _hg_status d + _wanted files expl 'missing files' _multi_parts / status_files +} + +_hg_modified() { + typeset -a status_files + _hg_status m + _wanted files expl 'modified files' _multi_parts / status_files +} + +_hg_resolve() { + local rstate rpah + + [[ -d $PREFIX ]] || PREFIX=$PREFIX:h + + _hg_cmd resolve -l ./$PREFIX 2> /dev/null | while read rstate rpath + do + [[ $rstate == 'R' ]] && resolved_files+=($rpath) + [[ $rstate == 'U' ]] && unresolved_files+=($rpath) + done +} + +_hg_resolved() { + typeset -a resolved_files unresolved_files + _hg_resolve + _wanted files expl 'resolved files' _multi_parts / resolved_files +} + +_hg_unresolved() { + typeset -a resolved_files unresolved_files + _hg_resolve + _wanted files expl 'unresolved files' _multi_parts / unresolved_files +} + +_hg_config() { + typeset -a items + items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*}) + (( $#items )) && _describe -t config 'config item' items +} + +_hg_addremove() { + _alternative 'files:unknown files:_hg_unknown' \ + 'files:missing files:_hg_missing' +} + +_hg_ssh_urls() { + if [[ -prefix */ ]] + then + if zstyle -T ":completion:${curcontext}:files" remote-access + then + local host=${PREFIX%%/*} + typeset -a remdirs + compset -p $(( $#host + 1 )) + local rempath=${(M)PREFIX##*/} + local cacheid="hg:${host}-${rempath//\//_}" + cacheid=${cacheid%[-_]} + compset -P '*/' + if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" + then + remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}" 2> /dev/null)"}##*/}%/}) + _store_cache "$cacheid" remdirs + fi + _describe -t directories 'remote directory' remdirs -S/ + else + _message 'remote directory' + fi + else + if compset -P '*@' + then + _hosts -S/ + else + _alternative 'hosts:remote host name:_hosts -S/' \ + 'users:user:_users -S@' + fi + fi +} + +_hg_urls() { + if compset -P bundle:// + then + _files + elif compset -P ssh:// + then + _hg_ssh_urls + elif [[ -prefix *: ]] + then + _urls + else + local expl + compset -S '[^:]*' + _wanted url-schemas expl 'URL schema' compadd -S '' - \ + http:// https:// ssh:// bundle:// + fi +} + +_hg_paths() { + typeset -a paths pnames + _hg_cmd paths 2> /dev/null | while read -A pnames + do + paths+=($pnames[1]) + done + (( $#paths )) && _describe -t path-aliases 'repository alias' paths +} + +_hg_remote() { + _alternative 'path-aliases:repository alias:_hg_paths' \ + 'directories:directory:_files -/' \ + 'urls:URL:_hg_urls' +} + +_hg_clone_dest() { + _alternative 'directories:directory:_files -/' \ + 'urls:URL:_hg_urls' +} + +# Common options +_hg_global_opts=( + '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/' + '(--verbose -v)'{-v,--verbose}'[enable additional output]' + '(--quiet -q)'{-q,--quiet}'[suppress output]' + '(--help -h)'{-h,--help}'[display help and exit]' + '--debugger[start debugger]' +) + +_hg_pat_opts=( + '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' + '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/') + +_hg_diff_opts=( + '(--text -a)'{-a,--text}'[treat all files as text]' + '(--git -g)'{-g,--git}'[use git extended diff format]' + "--nodates[don't include dates in diff headers]") + +_hg_style_opts=( + '--style[display using template map file]:' + '--template[display with template]:') + +_hg_commit_opts=( + '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' + '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:' + '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files') + +_hg_remote_opts=( + '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:' + '--remotecmd[specify hg command to run on the remote side]:') + +_hg_cmd() { + _call_program hg hg "$_hg_cmd_globals[@]" "$@" +} + +_hg_cmd_add() { + _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + '*:unknown files:_hg_unknown' +} + +_hg_cmd_annotate() { + _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \ + '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \ + '(--text -a)'{-a,--text}'[treat all files as text]' \ + '(--user -u)'{-u,--user}'[list the author]' \ + '(--date -d)'{-d,--date}'[list the date]' \ + '(--number -n)'{-n,--number}'[list the revision number (default)]' \ + '(--changeset -c)'{-c,--changeset}'[list the changeset]' \ + '*:files:_hg_files' +} + +_hg_cmd_clone() { + _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ + '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \ + '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \ + '--uncompressed[use uncompressed transfer (fast over LAN)]' \ + ':source repository:_hg_remote' \ + ':destination:_hg_clone_dest' +} + +_hg_cmd_commit() { + _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \ + '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ + '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \ + '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ + '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ + '*:file:_hg_files' +} + +_hg_cmd_vdiff() { + typeset -A opt_args + _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ + '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \ + '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ + '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ + '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ + '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ + '*:file:->diff_files' + + if [[ $state == 'diff_files' ]] + then + if [[ -n $opt_args[-r] ]] + then + _hg_files + else + _hg_modified + fi + fi +} + +_hg_cmd_export() { + _arguments -s -w : $_hg_global_opts $_hg_diff_opts \ + '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ + '--switch-parent[diff against the second parent]' \ + '*:revision:_hg_tags' +} + +_hg_cmd_grep() { + _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ + '--all[print all revisions with matches]' \ + '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ + '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ + '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ + '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ + '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \ + '(--user -u)'{-u,--user}'[print user who committed change]' \ + '1:search pattern:' \ + '*:files:_hg_files' +} + +_hg_cmd_heads() { + _arguments -s -w : $_hg_global_opts $_hg_style_opts \ + '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags' +} + +_hg_cmd_help() { + _arguments -s -w : $_hg_global_opts \ + '*:hgtk command:_hg_commands' +} + +_hg_cmd_incoming() { + _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ + '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ + '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ + '(--patch -p)'{-p,--patch}'[show patch]' \ + '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \ + '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ + '--bundle[file to store the bundles into]:bundle file:_files' \ + ':source:_hg_remote' +} + +_hg_cmd_init() { + _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ + ':dir:_files -/' +} + +_hg_cmd_log() { + _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \ + '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ + '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ + '(--copies -C)'{-C,--copies}'[show copied files]' \ + '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ + '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ + '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \ + '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ + '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ + '(--patch -p)'{-p,--patch}'[show patch]' \ + '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \ + '*:files:_hg_files' +} + +_hg_cmd_outgoing() { + _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ + '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ + '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ + '(--patch -p)'{-p,--patch}'[show patch]' \ + '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \ + '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ + ':destination:_hg_remote' +} + +_hg_cmd_pull() { + _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ + '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ + '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \ + '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \ + ':source:_hg_remote' +} + +_hg_cmd_push() { + _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ + '(--force -f)'{-f,--force}'[force push]' \ + '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_tags' \ + ':destination:_hg_remote' +} + +_hg_cmd_remove() { + _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + '(--after -A)'{-A,--after}'[record remove that has already occurred]' \ + '(--force -f)'{-f,--force}'[remove file even if modified]' \ + '*:file:_hg_files' +} + +_hg_cmd_rename() { + _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ + '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ + '*:file:_hg_files' +} + +_hg_cmd_revert() { + local context state line + typeset -A opt_args + + _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ + '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \ + '--no-backup[do not save backup copies of files]' \ + '*:file:->diff_files' + + if [[ $state == 'diff_files' ]] + then + if [[ -n $opt_args[-r] ]] + then + _hg_files + else + typeset -a status_files + _hg_status mard + _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files + fi + fi +} + +_hg_cmd_serve() { + _arguments -s -w : $_hg_global_opts \ + '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \ + '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \ + '(--daemon -d)'{-d,--daemon}'[run server in background]' \ + '(--port -p)'{-p+,--port}'[listen port]:listen port:' \ + '(--address -a)'{-a+,--address}'[interface address]:interface address:' \ + '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \ + '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \ + '--style[web template style]:style' \ + '--stdio[for remote clients]' \ + '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' +} + +_hg_cmd_status() { + _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + '(--all -A)'{-A,--all}'[show status of all files]' \ + '(--modified -m)'{-m,--modified}'[show only modified files]' \ + '(--added -a)'{-a,--added}'[show only added files]' \ + '(--removed -r)'{-r,--removed}'[show only removed files]' \ + '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \ + '(--clean -c)'{-c,--clean}'[show only files without changes]' \ + '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \ + '(--ignored -i)'{-i,--ignored}'[show ignored files]' \ + '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \ + '(--copies -C)'{-C,--copies}'[show source of copied files]' \ + '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ + '--rev[show difference from revision]:revision:_hg_tags' \ + '*:files:_files' +} + +_hg_cmd_update() { + _arguments -s -w : $_hg_global_opts \ + '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \ + '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \ + ':revision:_hg_tags' +} + +_hgtk "$@"
 
1
 
2
3
 
4
5
6
 
9
10
11
12
13
14
15
16
17
 
 
 
 
 
 
 
 
 
 
 
18
19
20
21
22
23
24
 
25
26
27
28
 
29
30
31
 
 
 
32
33
34
 
38
39
40
41
42
43
44
45
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
49
50
51
52
53
 
54
55
56
57
58
59
60
61
62
63
 
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
114
115
116
117
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
 
163
164
165
166
167
168
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
 
 
 
 
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
 
 
 
431
432
433
 
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
 
 
 
 
 
 
 
 
 
 
 
467
468
 
 
 
 
 
469
470
471
472
473
474
475
476
477
478
479
 
 
 
 
 
 
 
 
 
480
481
482
 
 
 
483
484
485
 
486
487
488
489
 
490
491
492
493
494
495
496
 
497
498
499
 
505
506
507
508
509
510
 
511
512
513
 
528
529
530
531
532
533
534
 
 
 
 
535
536
537
538
539
540
 
 
 
 
 
541
542
 
543
544
 
545
546
547
 
548
549
 
 
 
1
2
 
3
4
5
6
 
9
10
11
 
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
37
38
 
39
40
41
42
43
44
 
48
49
50
 
 
 
 
 
 
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
 
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
204
205
206
207
208
209
210
211
212
213
214
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
 
254
255
256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
 
 
 
 
 
 
 
 
 
 
276
277
278
279
280
281
282
283
284
285
 
 
286
287
288
289
290
 
291
292
293
294
 
295
296
297
298
299
300
301
 
302
303
304
305
 
311
312
313
 
314
 
315
316
317
318
 
333
334
335
 
 
 
 
336
337
338
339
340
 
 
 
 
 
341
342
343
344
345
346
 
347
348
 
349
350
 
 
351
352
 
353
@@ -1,6 +1,6 @@
-# Trivial Mercurial plugin for Nautilus +# TortoiseHg plugin for Nautilus  # -# Copyright (C) 2007 Steve Borho +# Copyright (C) 2007-9 Steve Borho  #  # Stolen mercilessly from nautilus-bzr, thanks guys  # Copyright (C) 2006 Jeff Bailey @@ -9,26 +9,36 @@
 #  # Published under the GNU GPL   -import gconf  import gtk  import gobject -from mercurial import hg, ui, match, util -from mercurial.node import short  import nautilus + +try: + from mercurial import demandimport +except ImportError: + # workaround to use user's local python libs + userlib = os.path.expanduser('~/lib/python') + if os.path.exists(userlib) and userlib not in sys.path: + sys.path.append(userlib) + from mercurial import demandimport +demandimport.enable() +  import os  import subprocess  import sys -import tempfile -import time  import urllib   +from mercurial import hg, ui, match, util  try:   from mercurial.error import RepoError  except ImportError:   from mercurial.repo import RepoError +from mercurial.node import short    TORTOISEHG_PATH = '~/tools/tortoisehg-dev' -TERMINAL_KEY = '/desktop/gnome/applications/terminal/exec' +nofilecmds = 'about serve synch repoconfig userconfig merge unmerge'.split() +nocachecmds = 'about serve repoconfig userconfig'.split() +    class HgExtension(nautilus.MenuProvider,   nautilus.ColumnProvider, @@ -38,26 +48,55 @@
  def __init__(self):   self.cacherepo = None   self.cacheroot = None - self.client = gconf.client_get_default() - thgpath = os.environ.get('TORTOISEHG_PATH', - os.path.expanduser(TORTOISEHG_PATH)) - os.environ['TORTOISEHG_PATH'] = thgpath - os.environ['THG_ICON_PATH'] = os.path.join(thgpath, 'icons') - self.hgproc = os.path.join(thgpath, 'hgproc.py') + self.scanStack = [] + + # check if nautilus-thg.py is a symlink first + pfile = __file__ + if pfile.endswith('.pyc'): + pfile = pfile[:-1] + path = os.path.dirname(os.path.realpath(pfile)) + thgpath = os.path.normpath(os.path.join(path, '..')) + testpath = os.path.join(thgpath, 'tortoise') + if os.path.isdir(testpath): + if thgpath not in sys.path: + sys.path.insert(0, thgpath) + else: + # try environment or hard-coded path + thgpath = os.environ.get('TORTOISEHG_PATH', TORTOISEHG_PATH) + thgpath = os.path.normpath(os.path.expanduser(thgpath)) + if os.path.exists(thgpath) and thgpath not in sys.path: + sys.path.insert(0, thgpath) + # else assume tortoise is already in PYTHONPATH + try: + import tortoise.thgutil + import tortoise.menuthg + except ImportError, e: + # if thgutil is not found, then repository cannot be found + # if menuthg is not found, you have an older version in sys.path + print e + self.menu = None + return + + self.env = os.environ + self.env['PYTHONPATH'] = ':'.join(sys.path) + self.env['TORTOISEHG_PATH'] = thgpath + self.env['THG_ICON_PATH'] = os.path.join(thgpath, 'icons') + + self.hgproc = tortoise.thgutil.find_path('hgtk', + tortoise.thgutil.get_prog_root()) + if not self.hgproc: + self.hgproc = tortoise.thgutil.find_path('hgtk')   self.ipath = os.path.join(thgpath, 'icons', 'tortoise') + self.menu = tortoise.menuthg.menuThg()     def icon(self, iname):   return os.path.join(self.ipath, iname)     def get_path_for_vfs_file(self, vfs_file): - if vfs_file.get_uri_scheme() != 'file': + if vfs_file.is_gone() or vfs_file.get_uri_scheme() != 'file':   return None   return urllib.unquote(vfs_file.get_uri()[7:])   - def clear_cached_repo(self): - self.cacheroot = None - self.cacherepo = None -   def get_repo_for_path(self, path):   '''   Find mercurial repository for vfs_file @@ -81,353 +120,132 @@
  self.cacheroot = None   self.cacherepo = None   return None + except StandardError, e: + print e + return None   - def _open_terminal_cb(self, window, vfs_file): - path = self.get_path_for_vfs_file(vfs_file) - if path is None: - return - os.chdir(path) - terminal = self.client.get_string(TERMINAL_KEY) - os.system('%s &' % terminal) - - def _about_cb(self, window, vfs_file): - self._run_dialog('about', [vfs_file]) - - def _add_cb(self, window, vfs_files): - self._run_dialog('add', vfs_files) - self.clear_cached_repo() - - def _clone_cb(self, window, vfs_file): - self._run_dialog('clone', [vfs_file]) - - def _commit_cb(self, window, vfs_files): - self._run_dialog('commit', vfs_files) - self.clear_cached_repo() - - def _datamine_cb(self, window, vfs_files): - self._run_dialog('datamine', vfs_files) - - def _diff_cb(self, window, vfs_files): - path = self.get_path_for_vfs_file(vfs_files[0]) - if path is None: - return - repo = self.get_repo_for_path(path) - if repo is None: - return - diffcmd = repo.ui.config('tortoisehg', 'vdiff', 'vdiff') - if not diffcmd: - self._run_dialog('diff', vfs_files) - else: - cmdline = ['hg', diffcmd] - cwd = os.path.isdir(path) and path or os.path.dirname(path) - paths = [self.get_path_for_vfs_file(f) for f in vfs_files] - subprocess.Popen(cmdline + paths, shell=False, cwd=cwd) - - def _history_cb(self, window, vfs_files): - self._run_dialog('history', vfs_files) - self.clear_cached_repo() - - def _init_cb(self, window, vfs_file): - self._run_dialog('init', [vfs_file]) - - def _recovery_cb(self, window, vfs_file): - self._run_dialog('recovery', [vfs_file]) - self.clear_cached_repo() - - def _revert_cb(self, window, vfs_files): - self._run_dialog('revert', vfs_files) - self.clear_cached_repo() - - def _serve_cb(self, window, vfs_file): - self._run_dialog('serve', [vfs_file], filelist=False) - - def _status_cb(self, window, vfs_file): - self._run_dialog('status', [vfs_file]) - - def _sync_cb(self, window, vfs_file): - self._run_dialog('synch', [vfs_file], filelist=False) - self.clear_cached_repo() - - def _thgconfig_repo_cb(self, window, vfs_file): - self._run_dialog('config', [vfs_file]) - - def _thgconfig_user_cb(self, window, vfs_file): - self._run_dialog('config', [vfs_file], filelist=False) - - def _unmerge_cb(self, window, vfs_file): - self._run_dialog('checkout', [vfs_file], filelist=False, - extras=['--', '--clean', str(self.rev0)]) - self.clear_cached_repo() - - def _run_dialog(self, hgcmd, vfs_files, filelist=True, extras=[]): + def run_dialog(self, menuitem, hgcmd, cwd = None):   '''   hgcmd - hgproc subcommand - vfs_files - directory, or list of selected files - filelist - bool for whether to generate file list for hgproc   ''' - paths = [self.get_path_for_vfs_file(f) for f in vfs_files] - if paths[0] is None: + if cwd: #bg + self.files = [] + else: + cwd = self.cwd + repo = self.get_repo_for_path(cwd) + + if hgcmd == 'vdiff': + diffcmd = repo.ui.config('tortoisehg', 'vdiff', 'vdiff') + if not diffcmd: + hgcmd = 'diff' + else: + cmdline = ['hg', diffcmd] + cmdline.extend(self.files) + subprocess.Popen(cmdline, shell=False, env=self.env, cwd=cwd) + return + + cmdopts = [sys.executable, self.hgproc, hgcmd] + + if hgcmd not in nofilecmds and self.files: + # Use stdin to pass file list (avoid shell command + # line limitations) + pipe = subprocess.PIPE + cmdopts += ['--listfile', '-'] + else: + pipe = None + + stdin = subprocess.Popen(cmdopts, cwd=cwd, stdin=pipe, env=self.env, shell=False).stdin + + if pipe: + stdin.write('\n'.join(self.files)) + stdin.close() + + if hgcmd not in nocachecmds: + # Remove cached repo object, dirstate may change + self.cacherepo = None + self.cacheroot = None + + def buildMenu(self, vfs_files, bg): + '''Build menu''' + self.pos = 0 + self.files = [] + files = [] + for vfs_file in vfs_files: + f = self.get_path_for_vfs_file(vfs_file) + if f: + files.append(f) + if not files:   return + if bg or len(files) == 1 and vfs_files[0].is_directory(): + cwd = files[0] + files = [] + else: + cwd = os.path.dirname(files[0]) + repo = self.get_repo_for_path(cwd) + if repo: + menus = self.menu.get_commands(repo, cwd, files) + if cwd == repo.root: + cwd_rel = '' + else: + cwd_rel = cwd[len(repo.root+os.sep):] + os.sep + for f in files: + cpath = util.canonpath(repo.root, cwd, f) + if cpath.startswith(cwd_rel): + cpath = cpath[len(cwd_rel):] + self.files.append(cpath) + else: + self.files.append(f) + else: + menus = self.menu.get_norepo_commands(cwd, files) + self.cwd = cwd + return self._buildMenu(menus)   - path = paths[0] - repo = self.get_repo_for_path(path) - cwd = os.path.isdir(path) and path or os.path.dirname(path) - - if repo is not None: - root = repo.root - else: - root = cwd - - cmdopts = [sys.executable, self.hgproc] - cmdopts += ['--root', root] - cmdopts += ['--cwd', cwd] - cmdopts += ['--command', hgcmd] - - if filelist: - # Use temporary file to store file list (avoid shell command - # line limitations) - fd, tmpfile = tempfile.mkstemp(prefix="tortoisehg_filelist_") - os.write(fd, "\n".join(paths)) - os.close(fd) - cmdopts += ['--listfile', tmpfile, '--deletelistfile'] - cmdopts.extend(extras) - - subprocess.Popen(cmdopts, cwd=cwd, shell=False) - - # Remove cached repo object, dirstate may change - self.cacherepo = None - self.cacheroot = None + def _buildMenu(self, menus): + '''Build one level of a menu''' + items = [] + if self.files: + passcwd = None + else: #bg + passcwd = self.cwd + for menu_info in menus: + idstr = 'HgNautilus::%02d%s' % (self.pos, menu_info.hgcmd) + self.pos += 1 + if menu_info.isSep(): + # can not insert a separator till now + pass + elif menu_info.isSubmenu(): + if hasattr(nautilus, 'Menu'): + item = nautilus.MenuItem(idstr, menu_info.menutext, + menu_info.helptext) + submenu = nautilus.Menu() + item.set_submenu(submenu) + for subitem in self._buildMenu(menu_info.get_menus()): + submenu.append_item(subitem) + items.append(item) + else: #submenu not suported + for subitem in self._buildMenu(menu_info.get_menus()): + items.append(subitem) + else: + if menu_info.state: + item = nautilus.MenuItem(idstr, + menu_info.menutext, + menu_info.helptext, + self.icon(menu_info.icon)) + item.connect('activate', self.run_dialog, menu_info.hgcmd, passcwd) + items.append(item) + return items     def get_background_items(self, window, vfs_file):   '''Build context menu for current directory''' - mainitem = nautilus.MenuItem('HgNautilus', 'Mercurial', '') - submenu = nautilus.Menu() - mainitem.set_submenu(submenu) - - path = self.get_path_for_vfs_file(vfs_file) - if path is None: - return - - repo = self.get_repo_for_path(path) - if repo is None: - ''' The name given to nautilus.MenuItem decides the - of the menu, which is ordered alpahbetically ''' - item = nautilus.MenuItem('HgNautilus::newtree', - 'Create New Repository', - 'Make directory versioned', - self.icon('menucreaterepos.ico')) - item.connect('activate', self._init_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::clone', - 'Create Clone', - 'Create clone here from source', - self.icon('menuclone.ico')) - item.connect('activate', self._clone_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::99about', - 'About TortoiseHg', - 'Information about TortoiseHg installation', - self.icon('menuabout.ico')) - item.connect('activate', self._about_cb, vfs_file) - submenu.append_item(item) - - return mainitem, - - if len(repo.changectx(None).parents()) > 1: - self.rev0 = repo.changectx(None).parents()[0].rev() - item = nautilus.MenuItem('HgNautilus::undomerge', - 'Undo Merge', - 'Clean checkout of original parent revision', - self.icon('menuunmerge.ico')) - item.connect('activate', self._unmerge_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::10commit', - 'Commit', - 'Commit changes', - self.icon('menucommit.ico')) - item.connect('activate', self._commit_cb, [vfs_file]) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::20status', - 'Show Status', - 'Show Repository Status', - self.icon('menushowchanged.ico')) - item.connect('activate', self._status_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::30diff', - 'Visual Diff', - 'Show Changes to Repository', - self.icon('menudiff.ico')) - item.connect('activate', self._diff_cb, [vfs_file]) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::40dag', - 'Revision History', - 'Show revision DAG', - self.icon('menurevisiongraph.ico')) - item.connect('activate', self._history_cb, [vfs_file]) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::50datamine', - 'Data Mining', - 'Search revision history', - self.icon('menulog.ico')) - item.connect('activate', self._datamine_cb, [vfs_file]) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::60sync', - 'Synchronize', - 'Sync with another repository', - self.icon('menusynch.ico')) - item.connect('activate', self._sync_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::70serve', - 'Web Server', - 'Start internal web server', - self.icon('proxy.ico')) - item.connect('activate', self._serve_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::75recover', - 'Recovery', - 'General repair and recovery of repository', - self.icon('general.ico')) - item.connect('activate', self._recovery_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::80repoconfig', - 'Repository Settings', - 'Configure Mercurial settings for this repo', - self.icon('menusettings.ico')) - item.connect('activate', self._thgconfig_repo_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::85userconfig', - 'User-Global Settings', - 'Configure global Mercurial settings', - self.icon('menusettings.ico')) - item.connect('activate', self._thgconfig_user_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::99about', - 'About TortoiseHg', - 'Information about TortoiseHg installation', - self.icon('menuabout.ico')) - item.connect('activate', self._about_cb, vfs_file) - submenu.append_item(item) - - return mainitem, + if vfs_file and self.menu: + return self.buildMenu([vfs_file], True) + else: + self.files = []     def get_file_items(self, window, vfs_files): - mainitem = nautilus.MenuItem('HgNautilus', 'Mercurial', '') - submenu = nautilus.Menu() - mainitem.set_submenu(submenu) - - '''Build context menu for selected files''' - if not vfs_files: - return None - - vfs_file = vfs_files[0] - path = self.get_path_for_vfs_file(vfs_file) - repo = self.get_repo_for_path(path) - if repo is None: - if not vfs_file.is_directory(): - return None - - # Menu for unrevisioned subdirectory - name = vfs_files[0].get_name() - item = nautilus.MenuItem('HgNautilus::10newtree', - 'Make directory versioned', - 'Create Repository in %s' % name, - self.icon('menucreaterepos.ico')) - item.connect('activate', self._init_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::20clone', - 'Create clone from source', - 'Create Clone in %s' % name, - self.icon('menuclone.ico')) - item.connect('activate', self._clone_cb, vfs_file) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::99about', - 'About TortoiseHg', - 'Information about TortoiseHg installation', - self.icon('menuabout.ico')) - item.connect('activate', self._about_cb, vfs_file) - submenu.append_item(item) - - return mainitem, - - localpaths = [] - for vfs_file in vfs_files: - path = self.get_path_for_vfs_file(vfs_file) - if path is None: - continue - localpath = path[len(repo.root)+1:] - localpaths.append(localpath) - - if not localpaths: - return - path = localpaths[0] - cwd = os.path.isdir(path) and path or os.path.dirname(path) - matcher = match.exact(repo.root, cwd, localpaths) - changes = repo.dirstate.status(matcher, True, True, True) - (lookup, modified, added, removed, deleted, unknown, - ignored, clean) = changes - - # Add menu items based on states list - if unknown: - item = nautilus.MenuItem('HgNautilus::30add', - 'Add Files', - 'Add unversioned files', - self.icon('menuadd.ico')) - item.connect('activate', self._add_cb, vfs_files) - submenu.append_item(item) - - if modified or added or removed or deleted or unknown: - item = nautilus.MenuItem('HgNautilus::40commit', - 'Commit Files', - 'Commit changes', - self.icon('menucommit.ico')) - item.connect('activate', self._commit_cb, vfs_files) - submenu.append_item(item) - - item = nautilus.MenuItem('HgNautilus::50revert', - 'Undo Changes', - 'Revert changes to files', - self.icon('menurevert.ico')) - item.connect('activate', self._revert_cb, vfs_files) - submenu.append_item(item) - - if modified or clean: - item = nautilus.MenuItem('HgNautilus::60log', - 'File Changelog', - 'Show file revision history', - self.icon('menulog.ico')) - item.connect('activate', self._history_cb, vfs_files) - item = nautilus.MenuItem('HgNautilus::annotate', - 'Annotate File', - 'Annotate file at current revision', - self.icon('menulog.ico')) - item.connect('activate', self._datamine_cb, vfs_files) - submenu.append_item(item) - - - if modified: - item = nautilus.MenuItem('HgNautilus::70diff', - 'File Diffs', - 'Show file changes', - self.icon('menudiff.ico')) - item.connect('activate', self._diff_cb, vfs_files) - submenu.append_item(item) - - return mainitem, + '''Build context menu for selected files/directories''' + if vfs_files and self.menu: + return self.buildMenu(vfs_files, False)     def get_columns(self):   return nautilus.Column("HgNautilus::80hg_status", @@ -436,64 +254,52 @@
  "Version control status"),     def _get_file_status(self, repo, localpath): - emblem = None - status = '?' - - # This is not what the API is optimized for, but this appears - # to work efficiently enough - matcher = match.always(repo.root, localpath) - changes = repo.dirstate.status(matcher, True, True, True) - (lookup, modified, added, removed, deleted, unknown, - ignored, clean) = changes - - if localpath in clean: - emblem = 'default' - status = 'clean' - elif localpath in modified: - emblem = 'cvs-modified' - status = 'modified' - elif localpath in added: - emblem = 'cvs-aded' - status = 'added' - elif localpath in unknown: - emblem = 'new' - status = 'unrevisioned' - elif localpath in ignored: - status = 'ignored' - elif localpath in deleted: - # Should be hard to reach this state - emblem = 'stockmail-priority-high' - status = 'deleted' + from tortoise import cachethg + cachestate = cachethg.get_state(localpath, repo) + cache2state = {cachethg.UNCHANGED: ('default', 'clean'), + cachethg.ADDED: ('cvs-added', 'added'), + cachethg.MODIFIED: ('cvs-modified', 'modified'), + cachethg.UNKNOWN: ('new', 'unrevisioned'), + cachethg.IGNORED: (None, 'ignored'), + cachethg.NOT_IN_REPO: (None, ''), + cachethg.ROOT: ('generic', 'root'), + cachethg.UNRESOLVED: ('cvs-confilict', 'unresolved')} + emblem, status = cache2state.get(cachestate, (None, '?'))   return emblem, status   + def update_file_info(self, file): + '''Queue file for emblem and hg status update''' + self.scanStack.append(file) + if len(self.scanStack) == 1: + gobject.idle_add(self.fileinfo_on_idle)   - def update_file_info(self, file): - '''Return emblem and hg status for this file''' - path = self.get_path_for_vfs_file(file) - if path is None or file.is_directory(): - return - repo = self.get_repo_for_path(path) - if repo is None: - return - localpath = path[len(repo.root)+1:] - emblem, status = self._get_file_status(repo, localpath) + def fileinfo_on_idle(self): + '''Update emblem and hg status for files when there is time''' + if not self.scanStack: + return False + vfs_file = self.scanStack.pop() + path = self.get_path_for_vfs_file(vfs_file) + if not path: + return True + emblem, status = self._get_file_status(self.cacherepo, path)   if emblem is not None: - file.add_emblem(emblem) - file.add_string_attribute('hg_status', status) + vfs_file.add_emblem(emblem) + vfs_file.add_string_attribute('hg_status', status) + return True     # property page borrowed from http://www.gnome.org/~gpoo/hg/nautilus-hg/ - def __add_row(self, table, row, label_item, label_value): + def __add_row(self, row, label_item, label_value):   label = gtk.Label(label_item)   label.set_use_markup(True)   label.set_alignment(1, 0) - table.attach(label, 0, 1, row, row + 1, gtk.FILL, gtk.FILL, 0, 0) + self.table.attach(label, 0, 1, row, row + 1, gtk.FILL, gtk.FILL, 0, 0)   label.show()     label = gtk.Label(label_value)   label.set_use_markup(True)   label.set_alignment(0, 1)   label.show() - table.attach(label, 1, 2, row, row + 1, gtk.FILL, 0, 0, 0) + self.table.attach(label, 1, 2, row, row + 1, gtk.FILL, 0, 0, 0)     def get_property_pages(self, vfs_files):   if len(vfs_files) != 1: @@ -505,9 +311,8 @@
  repo = self.get_repo_for_path(path)   if repo is None:   return -   localpath = path[len(repo.root)+1:] - emblem, status = self._get_file_status(repo, localpath) + emblem, status = self._get_file_status(repo, path)     # Get the information from Mercurial   ctx = repo.changectx(None).parents()[0] @@ -528,22 +333,21 @@
    self.property_label = gtk.Label('Mercurial')   - table = gtk.Table(7, 2, False) - table.set_border_width(5) - table.set_row_spacings(5) - table.set_col_spacings(5) + self.table = gtk.Table(7, 2, False) + self.table.set_border_width(5) + self.table.set_row_spacings(5) + self.table.set_col_spacings(5)   - self.__add_row(table, 0, '<b>Status</b>:', status) - self.__add_row(table, 1, '<b>Last-Commit-Revision</b>:', str(rev)) - self.__add_row(table, 2, '<b>Last-Commit-Description</b>:', description) - self.__add_row(table, 3, '<b>Last-Commit-Date</b>:', date) - self.__add_row(table, 4, '<b>Last-Commit-User</b>:', user) + self.__add_row(0, '<b>Status</b>:', status) + self.__add_row(1, '<b>Last-Commit-Revision</b>:', str(rev)) + self.__add_row(2, '<b>Last-Commit-Description</b>:', description) + self.__add_row(3, '<b>Last-Commit-Date</b>:', date) + self.__add_row(4, '<b>Last-Commit-User</b>:', user)   if tags: - self.__add_row(table, 5, '<b>Tags</b>:', tags) + self.__add_row(5, '<b>Tags</b>:', tags)   if branch != 'default': - self.__add_row(table, 6, '<b>Branch</b>:', branch) + self.__add_row(6, '<b>Branch</b>:', branch)   - table.show() - + self.table.show()   return nautilus.PropertyPage("MercurialPropertyPage::status", - self.property_label, table), + self.property_label, self.table),
Show Entire File contrib/​tracelog.py Stacked
renamed from tracelog.py
(No changes)
Change 1 of 1 Show Entire File contrib/​win32/​mercurial.ini Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
114
115
116
117
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
@@ -0,0 +1,175 @@
+; System-wide Mercurial config file. + +[ui] +; editor used to enter commit logs, etc. Most any text editor +; will suffice. +editor = notepad + +; In order to push/pull over ssh you must specify a ssh tool +ssh = "{app}\TortoisePlink.exe" -ssh -2 +;ssh = C:\cygwin\bin\ssh + +[merge-tools] +kdiff3.priority=-1 +kdiff3.args=-L1 base --L2 local --L3 other $base $local $other -o $output +kdiff3.regkey=Software\KDiff3 +kdiff3.regappend=\kdiff3.exe +kdiff3.fixeol=True +kdiff3.gui=True +beyondcompare3.priority=-2 +beyondcompare3.args=$local $other $base $output /ro /lefttitle=local /centertitle=base /righttitle=other /automerge /reviewconflicts /solo +beyondcompare3.regkey=Software\Scooter Software\Beyond Compare 3 +beyondcompare3.regname=ExePath +beyondcompare3.gui=True +diffmerge.priority=-7 +diffmerge.args=--nosplash --merge --title1=base --title2=local --title3=other $base $local $other +diffmerge.checkchanged=True +diffmerge.gui=True +p4merge.priority=-8 +p4merge.args=$base $local $other $output +p4merge.regkey=Software\Perforce\Environment +p4merge.regname=P4INSTROOT +p4merge.regappend=\p4merge.exe +p4merge.gui=True +tortoisemerge.priority=-9 +tortoisemerge.args=/base:$output /mine:$local /theirs:$other /merged:$output +tortoisemerge.regkey=Software\TortoiseSVN +tortoisemerge.gui=True +winmergeu.regkey=Software\Thingamahoochie\WinMerge\ +winmergeu.regname=Executable +winmergeu.priority=-10 +winmergeu.args=/e /ub /dl other /dr local $other $local $output +winmergeu.fixeol=True +winmergeu.gui=True + +; +; For more information about mercurial extensions, start here +; http://www.selenic.com/mercurial/wiki/index.cgi/UsingExtensions +; + +[extensions] +; extensions shipped with Mercurial by default +; +;acl = +;alias = +;bookmarks = +;bugzilla = +;children = +;churn = +; Warning: the color extension is not recommended for Windows +;color = +;convert = +extdiff = +;fetch = +;gpg = +;graphlog = +;hgcia = +;hgk = +;highlight = +;interhg = +;keyword = +;mq = +;notify = +;pager = +;parentrevspec = +;patchbomb = +;purge = +;rebase = +;record = +;transplant = +;win32mbcs = +;win32text = +;zeroconf = +; +; extra extensions provided by TortoiseHg +; +;qct = +;forest = + +; To use cleverencode/cleverdecode, you must enable win32text extension +; +; By default, we try to encode and decode all files that do not +; contain ASCII NUL characters. What this means is that we try to set +; line endings to Windows style on update, and to Unix style on +; commit. This lets us cooperate with Linux and Unix users, so +; everybody sees files with their native line endings. + +[encode] +; Encode files that don't contain NUL characters. + +; ** = cleverencode: + +; Alternatively, you can explicitly specify each file extension that +; you want encoded (any you omit will be left untouched), like this: + +; *.txt = dumbencode: + + +[decode] +; Decode files that don't contain NUL characters. + +; ** = cleverdecode: + +; Alternatively, you can explicitly specify each file extension that +; you want decoded (any you omit will be left untouched), like this: + +; **.txt = dumbdecode: + + +; +; Define external diff commands +; +[extdiff] +cmd.vdiff = {app}\kdiff3 +;cmd.vdiff = C:\Progra~1\TortoiseSVN\bin\TortoiseMerge.exe +;cmd.vimdiff = gvim.exe +;opts.vimdiff = -f '+next' '+execute "DirDiff ".argv(0)." ".argv(1)' + +[qct] +;See http://bitbucket.org/tortoisehg/stable/wiki/FAQ for details +;path="C:\Program Files\qct\qct.exe" + +[hgk] +;See http://bitbucket.org/tortoisehg/stable/wiki/FAQ for details +;path={app}\scripts\hgk.cmd +;vdiff=vdiff + +; +; The git extended diff format will properly store binary files, +; file permission changes, and rename information that the normal +; patch format cannot cover. However it is also not 100% compatible +; with tools which expect normal patches. so enable these at your +; own risk. +; +[diff] +;git = false +;nodates = false + +; +; Some optional defaults +; +[defaults] +;view = --limit 100 +;log = --limit 100 +;revert = --no-backup +;log = --style=changelog + +; +; Keyword extension example configuration. To use, one must +; enable the keyword extension, then uncomment and modify these +; two sections. Before using the keyword extension, be sure to +; thoroughly read it's documentation and understand how it works, +; and why it is not a core feature of Mercurial. +; +; http://www.selenic.com/mercurial/wiki/index.cgi/KeywordExtension +; http://www.selenic.com/mercurial/wiki/index.cgi/KeywordPlan +; +; If you encounter strange problems using Mercurial, a good first +; debugging step would be to disable this extension. +; +[keyword] +; expand keywords in all python files in working dir +;**.py = + +[keywordmaps] +; See documentation for examples
Change 1 of 1 Show Entire File contrib/​win32/​mercurial.iss Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
114
115
116
117
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
@@ -0,0 +1,214 @@
+; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +[Setup] +AppCopyright=Copyright 2005-2009 Matt Mackall and others +AppName=TortoiseHg +AppVerName=TortoiseHg-0.7 +InfoAfterFile=contrib/win32/postinstall.txt +LicenseFile=COPYING.txt +ShowLanguageDialog=yes +AppPublisher=TK Soh and others +AppPublisherURL=http://bitbucket.org/tortoisehg/stable/ +AppSupportURL=http://bitbucket.org/tortoisehg/stable/ +AppUpdatesURL=http://bitbucket.org/tortoisehg/stable/ +AppID=TortoiseHg +AppContact=teekaysoh@gmail.com +OutputBaseFilename=TortoiseHg-0.7 +DefaultDirName={pf}\TortoiseHg +SourceDir=..\.. +VersionInfoDescription=Mercurial distributed SCM +VersionInfoCopyright=Copyright 2005-2009 Matt Mackall and others +VersionInfoCompany=Matt Mackall and others +InternalCompressLevel=max +SolidCompression=true +SetupIconFile=..\icons\hgicon.ico +UninstallDisplayIcon={app}\hgicon.ico +WizardImageFile=..\icons\install-wizard.bmp +WizardImageStretch=no +WizardImageBackColor=$ffffff +WizardSmallImageFile=..\icons\install-wizard-small.bmp +AllowNoIcons=true +DefaultGroupName=TortoiseHg +PrivilegesRequired=poweruser +AlwaysRestart=yes +SetupLogging=yes + +[Files] +Source: contrib\mercurial.el; DestDir: {app}/contrib +Source: contrib\vim\*.*; DestDir: {app}/contrib/Vim +Source: contrib\zsh_completion; DestDir: {app}/contrib +Source: contrib\hgk; DestDir: {app}/contrib +Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme +Source: {app}\Mercurial.ini; DestDir: {app}\backup; Flags: external skipifsourcedoesntexist uninsneveruninstall +Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName: Mercurial.ini; AfterInstall: FileExpandString('{app}\Mercurial.ini') +Source: ..\stable.snap; DestDir: {app}; DestName: ReleaseNotes.txt +Source: ..\contrib\*.exe; DestDir: {app}; Flags: ignoreversion restartreplace uninsrestartdelete +Source: ..\contrib\TortoiseOverlays\*.*; DestDir: {app}/TortoiseOverlays; +Source: dist\*.exe; DestDir: {app}; Flags: ignoreversion restartreplace uninsrestartdelete +Source: dist\*.dll; DestDir: {app}; Flags: ignoreversion restartreplace uninsrestartdelete +Source: dist\*.pyd; DestDir: {app}; Flags: ignoreversion restartreplace uninsrestartdelete +Source: dist\library.zip; DestDir: {app} +Source: doc\*.html; DestDir: {app}\docs +Source: icons\*; DestDir: {app}\icons; Flags: ignoreversion recursesubdirs createallsubdirs +Source: dist\share\*; DestDir: {app}\share; Flags: ignoreversion recursesubdirs createallsubdirs +Source: dist\lib\*; DestDir: {app}\lib; Flags: ignoreversion recursesubdirs createallsubdirs +Source: dist\etc\*; DestDir: {app}\etc; Flags: ignoreversion recursesubdirs createallsubdirs +Source: templates\*.*; DestDir: {app}\templates; Flags: recursesubdirs createallsubdirs +Source: locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs +Source: i18n\*.*; DestDir: {app}\i18n; Flags: +Source: CONTRIBUTORS; DestDir: {app}; DestName: Contributors.txt +Source: COPYING.txt; DestDir: {app}; DestName: Copying.txt +Source: ..\icons\hgicon.ico; DestDir: {app} +Source: ..\files\gtkrc; DestDir: {app}\etc\gtk-2.0; AfterInstall: EditOptions() + +[INI] +Filename: {app}\Mercurial.url; Section: InternetShortcut; Key: URL; String: http://www.selenic.com/mercurial/ +Filename: {app}\TortoiseHg.url; Section: InternetShortcut; Key: URL; String: http://bitbucket.org/tortoisehg/stable/ + +[Icons] +Name: {group}\TortoiseHg Web Site; Filename: {app}\TortoiseHg.url +Name: {group}\Mercurial Web Site; Filename: {app}\Mercurial.url +Name: {group}\Mercurial Command Reference; Filename: {app}\docs\hg.1.html +Name: {group}\Python Trace Collector; Filename: {app}\tracelog.exe +Name: {group}\Uninstall TortoiseHg; Filename: {uninstallexe} + +[Run] +Filename: {app}\add_path.exe; Parameters: {app}; StatusMsg: Adding the installation path to the search path... +Filename: msiexec.exe; Parameters: "/i ""{app}\TortoiseOverlays\TortoiseOverlays-1.0.4.11886-win32.msi"" /qn /norestart ALLUSERS=1"; StatusMsg: Installing TortoiseOverlays.dll ... +Filename: regsvr32.exe; Parameters: "/s ""{app}\tortoisehg.dll"""; StatusMsg: Installing shell extension... + +[UninstallRun] +Filename: {app}\add_path.exe; Parameters: /del {app} +Filename: regsvr32.exe; Parameters: "/s /u ""{app}\tortoisehg.dll""" + +[UninstallDelete] +Type: files; Name: {app}\Mercurial.url +Type: files; Name: {app}\TortoiseHg.url + +[Registry] +Root: HKLM; Subkey: Software\TortoiseHg; Flags: uninsdeletekey; ValueData: {app} +Root: HKLM; Subkey: Software\Mercurial; Flags: uninsdeletekey; ValueData: {app}\Mercurial.ini + +[Code] +procedure FileExpandString(fn: String); +var + InFile: String; + i: Integer; + InFileLines: TArrayOfString; +begin + InFile := ExpandConstant(fn); + LoadStringsFromFile(InFile, InFileLines); + for i:= 0 to GetArrayLength(InFileLines)-1 do + InFileLines[i] := ExpandConstant(InFileLines[i]); + SaveStringsToFile(InFile, InFileLines, False); +end; + +var ThemePage: TInputOptionWizardPage; +var IsUpgrade: Boolean; + +procedure InitializeWizard; +begin + ThemePage := CreateInputOptionPage(wpSelectComponents, + 'Theme Selection', '', + 'Please select a theme, then click Next.', + True, False); + ThemePage.Add('Neutrino (recommended, especially on Vista)'); + ThemePage.Add('Brushed'); + ThemePage.Add('Blue-Steel'); + ThemePage.Add('MS-Windows (original)'); + + case GetPreviousData('Theme', '') of + 'Neutrino': ThemePage.SelectedValueIndex := 0; + 'Brushed': ThemePage.SelectedValueIndex := 1; + 'Blue-Steel': ThemePage.SelectedValueIndex := 2; + 'MS-Windows': ThemePage.SelectedValueIndex := 3; + else + ThemePage.SelectedValueIndex := 0; + end; +end; + +procedure RegisterPreviousData(PreviousDataKey: Integer); +var + Theme: String; +begin + { Store the settings so we can restore them next time } + case ThemePage.SelectedValueIndex of + 0: Theme := 'Neutrino'; + 1: Theme := 'Brushed'; + 2: Theme := 'Blue-Steel'; + 3: Theme := 'MS-Windows'; + end; + SetPreviousData(PreviousDataKey, 'Theme', Theme); +end; + +procedure SetCommentMarker(var lines: TArrayOfString; option: String; selected: boolean); +var + i : integer; +begin + if selected then exit; + for i := 0 to pred(GetArrayLength(lines)) do + if pos(option, lines[i]) > 0 then + begin + lines[i][1] := '#'; + end; +end; + +procedure EditOptions(); +var + lines : TArrayOfString; + filename : String; +begin + filename := ExpandConstant(CurrentFilename); + LoadStringsFromFile(filename, lines); + + SetCommentMarker(lines, 'gtk-theme-name = "Neutrino"', ThemePage.SelectedValueIndex = 0); + SetCommentMarker(lines, 'gtk-theme-name = "Brushed"', ThemePage.SelectedValueIndex = 1); + SetCommentMarker(lines, 'gtk-theme-name = "Blue-Steel"', ThemePage.SelectedValueIndex = 2); + SetCommentMarker(lines, 'gtk-theme-name = "MS-Windows"', ThemePage.SelectedValueIndex = 3); + + SaveStringsToFile(filename, lines, False); +end; + +function InitializeSetup(): Boolean; +var + ThgSwReg: String; + CRLF: String; + msg: String; +begin + CRLF := chr(10) + chr(13); + Result := True; + + {abort installation if TortoiseHg 0.4 or earlier is installed} + if RegQueryStringValue(HKLM, 'Software\TortoiseHg', '', ThgSwReg) then + begin + IsUpgrade := True; + {gpyfm was unbundled after 0.4, so it's a good guess} + if (FileExists(ThgSwReg + '\gpyfm.exe')) then + begin + msg := 'TortoiseHg Setup Error:' + CRLF + CRLF + + 'The version of TortoiseHg installed is too old to upgrade in place.' + CRLF + + 'You must uninstall it before installing this version.' + CRLF + CRLF + + 'Please uninstall the existing version, then run the installer again ' + + 'to continue.'; + MsgBox(msg, mbError, MB_OK); + Result := False; {quit and abort installation} + end else begin + msg := 'Your current site-wide Mercurial.ini will be copied into' + CRLF + + ThgSwReg + '\backup' + CRLF + + 'After install you may merge changes back into the new Mercurial.ini' + MsgBox(msg, mbInformation, MB_OK); + end; + end; +end; + +function ShouldSkipPage(PageID: Integer): Boolean; +begin + { Skip wpSelectDir page if upgrading; show all others } + case PageID of + wpSelectDir: + Result := IsUpgrade; + else + Result := False; + end; +end;
Change 1 of 1 Show Entire File contrib/​win32/​setup.cfg Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
@@ -0,0 +1,11 @@
+[py2exe] +excludes=pywin, pywin.dialogs, pywin.dialogs.list, PyQt, PyQt4.QtCode, PyQt4.QtGui +includes=cairo, pango, pangocairo, atk, gobject, dbhash +packages=email, hgext, hgext.convert, encodings, hggtk, hggtk.vis, hggtk.iniparse, tortoise + +# Disabled for 0.7 release +#dll_excludes=iconv.dll, intl.dll, libatk-1.0-0.dll, libgdk_pixbuf-2.0-0.dll, libgdk-win32-2.0-0.dll, libglib-2.0-0.dll, libgmodule-2.0-0.dll, libgobject-2.0-0.dll, libgthread-2.0-0.dll, libgtk-win32-2.0-0.dll, libpango-1.0-0.dll, libpangowin32-1.0-0.dll, libcairo-2.dll, libglade-2.0-0.dll, libpangocairo-1.0-0.dll, libpangoft2-1.0-0.dll + + +[build] +compiler=mingw32
Change 1 of 1 Show Entire File contrib/​win32/​setup.py Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
114
115
116
117
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
@@ -0,0 +1,234 @@
+#!/usr/bin/env python +# +# This is the mercurial setup script. +# +# 'python setup.py install', or +# 'python setup.py --help' for more options + +import sys +if not hasattr(sys, 'version_info') or sys.version_info < (2, 3, 0, 'final'): + raise SystemExit("Mercurial requires python 2.3 or later.") + +# Solaris Python packaging brain damage +try: + import hashlib + sha = hashlib.sha1() +except: + try: + import sha + except: + raise SystemExit( + "Couldn't import standard hashlib (incomplete Python install).") + +try: + import zlib +except: + raise SystemExit( + "Couldn't import standard zlib (incomplete Python install).") + +import os, time +import shutil +import tempfile +from distutils.core import setup, Extension +from distutils.dist import Distribution +from distutils.command.install_data import install_data +from distutils.command.build import build +from distutils.command.build_py import build_py +from distutils.spawn import spawn, find_executable +from distutils.ccompiler import new_compiler + +extra = {} +scripts = ['hg'] +if os.name == 'nt': + scripts.append('contrib/win32/hg.bat') + +# simplified version of distutils.ccompiler.CCompiler.has_function +# that actually removes its temporary files. +def has_function(cc, funcname): + tmpdir = tempfile.mkdtemp(prefix='hg-install-') + devnull = oldstderr = None + try: + try: + fname = os.path.join(tmpdir, 'funcname.c') + f = open(fname, 'w') + f.write('int main(void) {\n') + f.write(' %s();\n' % funcname) + f.write('}\n') + f.close() + # Redirect stderr to /dev/null to hide any error messages + # from the compiler. + # This will have to be changed if we ever have to check + # for a function on Windows. + devnull = open('/dev/null', 'w') + oldstderr = os.dup(sys.stderr.fileno()) + os.dup2(devnull.fileno(), sys.stderr.fileno()) + objects = cc.compile([fname]) + cc.link_executable(objects, os.path.join(tmpdir, "a.out")) + except: + return False + return True + finally: + if oldstderr is not None: + os.dup2(oldstderr, sys.stderr.fileno()) + if devnull is not None: + devnull.close() + shutil.rmtree(tmpdir) + +# py2exe needs to be installed to work +try: + import py2exe + + # Help py2exe to find win32com.shell + try: + import modulefinder + import win32com + for p in win32com.__path__[1:]: # Take the path to win32comext + modulefinder.AddPackagePath("win32com", p) + pn = "win32com.shell" + __import__(pn) + m = sys.modules[pn] + for p in m.__path__[1:]: + modulefinder.AddPackagePath(pn, p) + except ImportError: + pass + + extra['windows'] = [ + {'script':'contrib/tracelog.py', + 'icon_resources':[(1, 'icons/tortoise/python.ico')]} + ] + extra['com_server'] = ['tortoisehg'] + extra['console'] = ['hg', 'hgtk'] + +except ImportError: + pass + +try: + from mercurial.__version__ import version +except ImportError: + version = 'unknown' + +class install_package_data(install_data): + def finalize_options(self): + self.set_undefined_options('install', + ('install_lib', 'install_dir')) + install_data.finalize_options(self) + +class build_mo(build): + + description = "build translations (.mo files)" + + def run(self): + if not find_executable('msgfmt'): + self.warn("could not find msgfmt executable, no translations " + "will be built") + return + + podir = 'i18n' + if not os.path.isdir(podir): + self.warn("could not find %s/ directory" % podir) + return + + join = os.path.join + for po in os.listdir(podir): + if not po.endswith('.po'): + continue + pofile = join(podir, po) + modir = join('locale', po[:-3], 'LC_MESSAGES') + mofile = join(modir, 'hg.mo') + cmd = ['msgfmt', '-v', '-o', mofile, pofile] + if sys.platform != 'sunos5': + # msgfmt on Solaris does not know about -c + cmd.append('-c') + self.mkpath(modir) + self.make_file([pofile], mofile, spawn, (cmd,)) + self.distribution.data_files.append((join('mercurial', modir), + [mofile])) + +build.sub_commands.append(('build_mo', None)) + +Distribution.pure = 0 +Distribution.global_options.append(('pure', None, "use pure (slow) Python " + "code instead of C extensions")) + +class hg_build_py(build_py): + + def finalize_options(self): + build_py.finalize_options(self) + + if self.distribution.pure: + if self.py_modules is None: + self.py_modules = [] + for ext in self.distribution.ext_modules: + if ext.name.startswith("mercurial."): + self.py_modules.append("mercurial.pure.%s" % ext.name[10:]) + self.distribution.ext_modules = [] + + def find_modules(self): + modules = build_py.find_modules(self) + for module in modules: + if module[0] == "mercurial.pure": + if module[1] != "__init__": + yield ("mercurial", module[1], module[2]) + else: + yield module + +cmdclass = {'install_data': install_package_data, + 'build_mo': build_mo, + 'build_py': hg_build_py} + +ext_modules=[ + Extension('mercurial.base85', ['mercurial/base85.c']), + Extension('mercurial.bdiff', ['mercurial/bdiff.c']), + Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c']), + Extension('mercurial.mpatch', ['mercurial/mpatch.c']), + Extension('mercurial.parsers', ['mercurial/parsers.c']), + ] + +packages = ['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert', + 'hgext.highlight', 'hgext.zeroconf', 'hggtk', 'hggtk.vis', + 'hggtk.iniparse', 'tortoise'] + +try: + import msvcrt + ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'])) +except ImportError: + pass + +try: + import posix + ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'])) + + if sys.platform == 'linux2' and os.uname()[2] > '2.6': + # The inotify extension is only usable with Linux 2.6 kernels. + # You also need a reasonably recent C library. + cc = new_compiler() + if has_function(cc, 'inotify_add_watch'): + ext_modules.append(Extension('hgext.inotify.linux._inotify', + ['hgext/inotify/linux/_inotify.c'])) + packages.extend(['hgext.inotify', 'hgext.inotify.linux']) +except ImportError: + pass + +datafiles = [] +for root in ('templates', 'i18n'): + for dir, dirs, files in os.walk(root): + datafiles.append((os.path.join('mercurial', dir), + [os.path.join(dir, file_) for file_ in files])) + +setup(name='mercurial', + version=version, + author='Matt Mackall', + author_email='mpm@selenic.com', + url='http://selenic.com/mercurial', + description='Scalable distributed SCM', + license='GNU GPL', + scripts=scripts, + packages=packages, + ext_modules=ext_modules, + data_files=datafiles, + cmdclass=cmdclass, + options=dict(bdist_mpkg=dict(zipdist=True, + license='COPYING', + readme='contrib/macosx/Readme.html', + welcome='contrib/macosx/Welcome.html')), + **extra)
Change 1 of 1 Show Entire File hggtk/​__init__.py Stacked
 
1
2
3
4
5
6
7
8
9
 
 
 
 
 
 
 
 
 
 
@@ -1,9 +0,0 @@
-import pygtk -pygtk.require('2.0') -import gtk - -# Default icon for apps which do not set one -from shlib import get_tortoise_icon -icon = get_tortoise_icon("hg.ico") -if icon: - gtk.window_set_default_icon_from_file(icon)
Change 1 of 3 Show Entire File hggtk/​about.py Stacked
 
11
12
13
 
14
15
16
 
56
57
58
59
 
60
61
62
 
68
69
70
71
 
 
 
 
 
 
 
72
73
74
75
76
 
11
12
13
14
15
16
17
 
57
58
59
 
60
61
62
63
 
69
70
71
 
72
73
74
75
76
77
78
79
 
80
81
82
@@ -11,6 +11,7 @@
 pygtk.require('2.0')  import gtk  import shlib +from mercurial.i18n import _    try:   # post 1.1.2 @@ -56,7 +57,7 @@
  "GTK-%s" % make_version(gtk.gtk_version),   ])   - comment = "Several icons are courtesy of the TortoiseSVN project" + comment = _("Several icons are courtesy of the TortoiseSVN project")     self.set_website("http://bitbucket.org/tortoisehg/stable/")   self.set_name("TortoiseHg") @@ -68,9 +69,14 @@
  thg_logo = os.path.normpath(shlib.get_tortoise_icon('thg_logo_92x50.png'))   thg_icon = os.path.normpath(shlib.get_tortoise_icon('thg_logo.ico'))   prog_root = os.path.dirname(os.path.dirname(os.path.dirname(thg_icon))) - license_file = os.path.join(prog_root, "COPYING.txt") + try: + license_file = os.path.join(prog_root, "COPYING.txt") + self.set_license(file(license_file).read()) + except IOError: + import hgtk + license = hgtk.shortlicense.splitlines()[1:] + self.set_license('\n'.join(license))   - self.set_license(file(license_file).read())   self.set_comments("with " + lib_versions + "\n\n" + comment)   self.set_logo(gtk.gdk.pixbuf_new_from_file(thg_logo))   self.set_icon_from_file(thg_icon)
Change 1 of 1 Show Entire File hggtk/​addremove.py Stacked
 
1
2
3
4
5
6
7
8
9
10
11
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -1,50 +0,0 @@
-# -# Add/Remove dialog for TortoiseHg -# -# Copyright (C) 2007 TK Soh <teekaysoh@gmail.com> -# - -try: - import pygtk - pygtk.require("2.0") -except: - pass - -import gtk -import gobject -from mercurial import ui, util, hg -from mercurial.i18n import _ -from status import GStatus - -def run(hgcmd='add', root='', cwd='', files=[], **opts): - u = ui.ui() - u.updateopts(debug=False, traceback=False) - repo = hg.repository(u, path=root) - - cmdoptions = { - 'all':False, 'clean':False, 'ignored':False, 'modified':False, - 'added':True, 'removed':True, 'deleted':True, 'unknown':False, 'rev':[], - 'exclude':[], 'include':[], 'debug':True,'verbose':True - } - - if hgcmd == 'add': - cmdoptions['unknown'] = True - elif hgcmd == 'remove': - cmdoptions['clean'] = True - else: - raise "Invalid command '%s'" % hgcmd - - dialog = GStatus(u, repo, cwd, files, cmdoptions, True) - - gtk.gdk.threads_init() - gtk.gdk.threads_enter() - dialog.display() - gtk.main() - gtk.gdk.threads_leave() - -if __name__ == "__main__": - import sys - opts = {} - opts['hgcmd'] = 'adda' - opts['root'] = len(sys.argv) > 1 and sys.argv[1] or '' - run(**opts)
Change 1 of 6 Show Entire File hggtk/​backout.py Stacked
 
10
11
12
 
13
14
15
 
19
20
21
22
 
23
24
25
 
31
32
33
34
 
35
36
 
37
38
39
 
44
45
46
47
 
48
49
50
51
 
52
53
54
55
56
57
58
 
59
60
 
61
62
63
64
65
66
 
67
68
69
70
71
 
 
72
73
74
 
81
82
83
84
 
85
86
87
 
104
105
106
107
108
 
 
109
110
111
 
10
11
12
13
14
15
16
 
20
21
22
 
23
24
25
26
 
32
33
34
 
35
36
 
37
38
39
40
 
45
46
47
 
48
49
50
51
 
52
53
54
55
56
57
58
 
59
60
 
61
62
63
64
65
66
 
67
68
69
70
 
 
71
72
73
74
75
 
82
83
84
 
85
86
87
88
 
105
106
107
 
 
108
109
110
111
112
@@ -10,6 +10,7 @@
 import pango  from dialog import *  from hgcmd import CmdDialog +from mercurial.i18n import _  import histselect    class BackoutDialog(gtk.Window): @@ -19,7 +20,7 @@
  gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)     self.root = root - self.set_title('Backout changeset - ' + rev) + self.set_title(_('Backout changeset - ') + rev)   self.set_default_size(600, 400)   self.notify_func = None   @@ -31,9 +32,9 @@
  sep.set_draw(False)     tbuttons = [ - self._toolbutton(gtk.STOCK_GO_BACK, 'Backout', + self._toolbutton(gtk.STOCK_GO_BACK, _('Backout'),   self._backout_clicked, - 'Backout selected changeset') + _('Backout selected changeset'))   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -44,31 +45,31 @@
  # From: combo box   self.reventry = gtk.Entry()   self.reventry.set_text(rev) - self.browse = gtk.Button("Browse...") + self.browse = gtk.Button(_('Browse...'))   self.browse.connect('clicked', self._btn_rev_clicked)     hbox = gtk.HBox() - hbox.pack_start(gtk.Label('Revision to backout:'), False, False, 4) + hbox.pack_start(gtk.Label(_('Revision to backout:')), False, False, 4)   hbox.pack_start(self.reventry, True, True, 4)   hbox.pack_start(self.browse, False, False, 4)   vbox.pack_start(hbox, False, False, 4)     self.logview = gtk.TextView(buffer=None)   self.logview.set_editable(True) - self.logview.modify_font(pango.FontDescription("Monospace")) + self.logview.modify_font(pango.FontDescription('Monospace'))   buf = self.logview.get_buffer() - buf.set_text('Backed out changeset: ' + rev) + buf.set_text(_('Backed out changeset: ') + rev)   scrolledwindow = gtk.ScrolledWindow()   scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)   scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)   scrolledwindow.add(self.logview)   scrolledwindow.set_border_width(4) - frame = gtk.Frame('Backout commit message') + frame = gtk.Frame(_('Backout commit message'))   frame.set_border_width(4)   frame.add(scrolledwindow)   self.tips.set_tip(frame, - 'Commit message text for new changeset that reverses the' - ' effect of the change being backed out.') + _('Commit message text for new changeset that reverses the' + ' effect of the change being backed out.'))   vbox.pack_start(frame, True, True, 4)     def set_notify_func(self, func, *args): @@ -81,7 +82,7 @@
  if rev is not None:   self.reventry.set_text(rev)   buf = self.logview.get_buffer() - buf.set_text('Backed out changeset: ' + rev) + buf.set_text(_('Backed out changeset: ') + rev)     def _toolbutton(self, stock, label, handler, tip):   tbutton = gtk.ToolButton(stock) @@ -104,8 +105,8 @@
   def run(root='', **opts):   # This dialog is intended to be launched by the changelog browser - # It's not expected to be used from hgproc or the command line. I - # leave this path in place for testing purposes. + # It's not expected to be used from hgtk. I leave this path in + # place for testing purposes.   dialog = BackoutDialog(root, 'tip')   dialog.show_all()   dialog.connect('destroy', gtk.main_quit)
Show Entire File hggtk/​bugreport.py Stacked
copied from hggtk/status.py
This file's diff was not loaded because this changeset is very large. Load changes
 
451
452
453
 
454
455
456
 
632
633
634
 
 
 
 
 
 
 
 
 
 
 
 
 
 
635
636
637
 
660
661
662
663
 
664
665
 
666
667
668
 
451
452
453
454
455
456
457
 
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
 
675
676
677
 
678
679
 
680
681
682
683
@@ -451,6 +451,7 @@
  return menuitem     _menu = gtk.Menu() + _menu.append(create_menu('_visual diff', self._diff_file_rev))   _menu.append(create_menu('_view at revision', self._view_file_rev))   self._save_menu = create_menu('_save at revision', self._save_file_rev)   _menu.append(self._save_menu) @@ -632,6 +633,20 @@
  hgcmd_toq(self.repo.root, q, 'cat', '--rev',   str(self.currev), '--output', result, cpath)   + def _diff_file_rev(self, menuitem): + '''User selected visual diff file revision from the file list context menu''' + if not self.curfile: + # ignore view events for the [Description] row + return + rev = self.currev + parents = self.parents + if len(parents) == 0: + parent = rev-1 + else: + parent = parents[0] + self.opts['rev'] = [str(parent), str(rev)] + self._diff_file('M', self.curfile) +   def _view_file_rev(self, menuitem):   '''User selected view file revision from the file list context menu'''   if not self.curfile: @@ -660,9 +675,9 @@
  if self.glog_parent:   # If this changeset browser is embedded in glog, send   # send this event to the main app - opts = {'filehist' : self.curfile} + opts = {'pats' : [self.curfile]}   self.glog_parent.custombutton.set_active(True) - self.glog_parent.graphview.refresh(True, None, opts) + self.glog_parent.reload_log(opts)   else:   # Else launch our own GLog instance   import history
Show Entire File hggtk/​clone.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​commit.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​datamine.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Change 1 of 2 Show Entire File hggtk/​dialog.py Stacked
 
18
19
20
 
21
22
23
24
25
26
27
28
 
53
54
55
56
 
57
58
59
 
18
19
20
21
22
 
 
 
 
23
24
25
 
50
51
52
 
53
54
55
56
@@ -18,11 +18,8 @@
 pygtk.require("2.0")  import gtk  from gtklib import MessageDialog +from mercurial.i18n import _   - -def about(): - raise "About dialog currently under construction" -  def _message_dialog(parent, type, primary, secondary, buttons=gtk.BUTTONS_OK,   title="TortoiseHg"):   """ Display a given type of MessageDialog with the given message. @@ -53,7 +50,7 @@
  gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)   dialog = gtk.Dialog(parent=parent, flags=gtk.DIALOG_MODAL,   buttons=buttons) - dialog.set_title('TortoiseHg Prompt') + dialog.set_title(_('TortoiseHg Prompt'))   entry = gtk.Entry()   entry.set_text(default or '')   entry.set_visibility(visible)
Show Entire File hggtk/​diff.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​gdialog.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Change 1 of 2 Show Entire File hggtk/​gtklib.py Stacked
 
9
10
11
 
12
13
14
 
33
34
35
36
 
37
38
39
40
41
42
 
43
44
45
 
9
10
11
12
13
14
15
 
34
35
36
 
37
38
39
40
41
42
 
43
44
45
46
@@ -9,6 +9,7 @@
 import gtk  import gobject  import pango +from mercurial.i18n import _    class StatusBar(gtk.HBox):   def __init__(self, extra=None): @@ -33,13 +34,13 @@
  self.pbar.pulse()   return True   - def begin(self, msg="Running", timeout=100): + def begin(self, msg=_('Running'), timeout=100):   self.pbox.set_child_visible(True)   self.pbox.map()   self.set_status_text(msg)   self._timeout_event = gobject.timeout_add(timeout, self._pulse_timer)   - def end(self, msg="Done", unmap=True): + def end(self, msg=_('Done'), unmap=True):   gobject.source_remove(self._timeout_event)   self.set_status_text(msg)   if unmap:
Show Entire File hggtk/​gtools.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​guess.py Stacked
copied from hggtk/rename.py
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​hgcmd.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​hgemail.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​hgignore.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​hginit.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​hglib.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​hgshelve.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​hgtk.py Stacked
renamed from contrib/hgtk
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​history.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​histselect.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​logfilter.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​merge.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​recovery.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​rename.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​revisions.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​revtree.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​serve.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​shlib.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​status.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​synch.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​tagadd.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​tags.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hggtk/​thgconfig.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
 
71
72
73
74
75
76
77
 
 
 
 
78
79
80
 
137
138
139
140
 
141
142
143
 
146
147
148
149
150
151
 
 
 
 
 
152
153
154
 
71
72
73
 
 
 
 
74
75
76
77
78
79
80
 
137
138
139
 
140
141
142
143
 
146
147
148
 
 
 
149
150
151
152
153
154
155
156
@@ -71,10 +71,10 @@
  def get_tbbuttons(self):   tbbuttons = GStatus.get_tbbuttons(self)   tbbuttons.insert(2, gtk.SeparatorToolItem()) - self.shelve_btn = self.make_toolbutton(gtk.STOCK_FILE, 'Shelve', - self._shelve_clicked, tip='set aside selected changes') - self.unshelve_btn = self.make_toolbutton(gtk.STOCK_EDIT, 'Unshelve', - self._unshelve_clicked, tip='restore shelved changes') + self.shelve_btn = self.make_toolbutton(gtk.STOCK_FILE, _('Shelve'), + self._shelve_clicked, tip=_('set aside selected changes')) + self.unshelve_btn = self.make_toolbutton(gtk.STOCK_EDIT, _('Unshelve'), + self._unshelve_clicked, tip=_('restore shelved changes'))   tbbuttons.insert(2, self.unshelve_btn)   tbbuttons.insert(2, self.shelve_btn)   return tbbuttons @@ -137,7 +137,7 @@
  if file:   hlist = [cid for cid in hlist if chunks[cid].filename() == file]   if not hlist: - Prompt('Shelve', 'Please select diff chunks to shelve', + Prompt(_('Shelve'), _('Please select diff chunks to shelve'),   self).run()   return   @@ -146,9 +146,11 @@
  if self._has_shelve_file():   from gtklib import MessageDialog   dialog = MessageDialog(flags=gtk.DIALOG_MODAL) - dialog.set_title('Shelve') - dialog.set_markup('<b>Shelve file exists!</b>') - dialog.add_buttons('Overwrite', 1, 'Append', 2, 'Cancel', -1) + dialog.set_title(_('Shelve')) + dialog.set_markup(_('<b>Shelve file exists!</b>')) + dialog.add_buttons(_('Overwrite'), 1, + _('Append'), 2, + _('Cancel'), -1)   dialog.set_transient_for(self)   rval = dialog.run()   dialog.destroy()
Show Entire File hggtk/​update.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hgproc.bat Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hgproc.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File hgtk Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Removed image
Show Entire File setup.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Change 1 of 1 Show Entire File tortoise/​__init__.py Stacked
 
1
2
3
4
5
6
 
 
 
 
 
 
 
@@ -1,6 +0,0 @@
- -import gettext - -# Add '_' to the builtin namespace -gettext.install('olive-gtk') -
Show Entire File tortoise/​cachethg.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File tortoise/​contextmenu.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File tortoise/​iconoverlay.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File tortoise/​menuthg.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File tortoise/​shellconf.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File tortoise/​thgutil.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
Show Entire File tortoisehg.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes