Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

util: prune functions from hgview's util file

Changeset d82b7376d655

Parent 46ecbd4f3c5a

by Steve Borho

Changes to 3 files · Browse files at d82b7376d655 Showing diff from parent 46ecbd4f3c5a Diff from another changeset...

 
28
29
30
31
 
32
33
34
 
507
508
509
 
 
 
 
 
 
 
 
 
 
 
510
511
512
 
28
29
30
 
31
32
33
34
 
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
@@ -28,7 +28,7 @@
 from PyQt4 import QtGui, QtCore, Qsci  from PyQt4.QtCore import Qt   -from tortoisehg.util.util import tounicode, rootpath +from tortoisehg.util.hglib import tounicode    from tortoisehg.hgqt.qtlib import geticon  from tortoisehg.hgqt.dialogmixin import HgDialogMixin @@ -507,6 +507,17 @@
  vbar.setValue(bvalue)   self._invbarchanged = False   +def rootpath(repo, rev, path): + """return the path name of 'path' relative to repo's root at + revision rev; + path is relative to cwd + """ + ctx = repo[rev] + filenames = list(ctx.walk(cmdutil.match(repo, [path], {}))) + if len(filenames) != 1 or filenames[0] not in ctx.manifest(): + return None + else: + return filenames[0]    if __name__ == '__main__':   from mercurial import ui, hg
 
12
13
14
15
16
17
18
19
 
39
40
41
42
43
44
45
 
12
13
14
 
 
15
16
17
 
37
38
39
 
40
41
42
@@ -12,8 +12,6 @@
   from mercurial import hg   -from tortoisehg.util.util import has_closed_branch_support -  from tortoisehg.hgqt.i18n import _    from tortoisehg.hgqt.qtlib import geticon, getfont @@ -39,7 +37,6 @@
  self.workbench = workbench   self.stackedWidget = workbench.stackedWidget   self.commitWidget = commitWidget - self._closed_branch_supp = has_closed_branch_support(self.repo)   self._reload_rev = '.'   self._loading = True   self._scanForRepoChanges = True
 
10
11
12
13
14
15
16
 
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
 
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
 
10
11
12
 
13
14
15
 
22
23
24
 
 
 
 
 
 
 
 
 
 
 
 
 
25
26
27
28
 
 
29
30
 
 
 
 
 
 
 
 
31
32
33
 
34
35
36
37
 
41
42
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
45
46
@@ -10,7 +10,6 @@
 """  import os  import string -from mercurial import cmdutil    def tounicode(string):   """ @@ -23,36 +22,16 @@
  pass   return unicode(string, 'utf-8', 'replace')   -def has_closed_branch_support(repo): - """ - Return True is repository have support for closed branches - """ - # what a hack... - return "closed" in repo.heads.im_func.func_code.co_varnames - -def isexec(filectx): - """ - Return True is the file at filectx revision is executable - """ - if hasattr(filectx, "isexec"): - return filectx.isexec()   return "x" in filectx.flags()    def exec_flag_changed(filectx):   """ - Return True if the file referenced by filectx has changed its exec - flag + Return 'set' or 'unset' on change, or '' if unchanged   """ - flag = isexec(filectx) - parents = filectx.parents() - if not parents: - return "" - - pflag = isexec(parents[0]) - if flag != pflag: - if flag: + for pfctx in filectx.parents(): + if 'x' in filectx.flags() and 'x' not in pfctx.flags():   return "set" - else: + if 'x' not in filectx.flags() and 'x' in pfctx.flags():   return "unset"   return ""   @@ -62,31 +41,6 @@
 def bfilepath(filename):   return filename and filename.replace('.hgbfiles' + os.sep, '')   -def find_repository(path): - """returns <path>'s mercurial repository - - None if <path> is not under hg control - """ - path = os.path.abspath(path) - while not os.path.isdir(os.path.join(path, ".hg")): - oldpath = path - path = os.path.dirname(path) - if path == oldpath: - return None - return path - -def rootpath(repo, rev, path): - """return the path name of 'path' relative to repo's root at - revision rev; - path is relative to cwd - """ - ctx = repo[rev] - filenames = list(ctx.walk(cmdutil.match(repo, [path], {}))) - if len(filenames) != 1 or filenames[0] not in ctx.manifest(): - return None - else: - return filenames[0] -  class Curry(object):   """Curryfication de fonction (http://fr.wikipedia.org/wiki/Curryfication)"""   def __init__(self, function, *additional_args, **additional_kwargs):