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

hgtk: convert provided abspaths to canonical

This mapping used to by done by the shell extensions, but now we
do it here to save complexity in the C++ extensions.

Changeset 02304bccc7dd

Parent b0b707b12891

by Steve Borho

Changes to one file · Browse files at 02304bccc7dd Showing diff from parent b0b707b12891 Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​hgtk.py Stacked
 
64
65
66
67
68
69
70
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
73
74
 
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
@@ -64,11 +64,31 @@
  lines = [ x.replace("\n", "") for x in fd.readlines() ]   fd.close()   os.unlink(filename) - return lines   except IOError, e:   sys.stderr.write(_('can not read file "%s". Ignored.\n') % filename)   return []   + # Convert absolute file paths to repo/cwd canonical + cwd = os.getcwd() + root = paths.find_root() + if cwd == root: + cwd_rel = '' + else: + cwd_rel = cwd[len(root+os.sep):] + os.sep + files = [] + for f in lines: + try: + cpath = util.canonpath(root, cwd, f) + # canonpath will abort on .hg/ paths + except util.Abort: + pass + if cpath.startswith(cwd_rel): + cpath = cpath[len(cwd_rel):] + files.append(cpath) + else: + files.append(f) + return files +  def _parse(ui, args):   options = {}   cmdoptions = {}