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

cmenu: better relative path algorithm

Changeset a13e3aba2ab2

Parent 69510f1131aa

by Simon Heimberg

Changes to 2 files · Browse files at a13e3aba2ab2 Showing diff from parent 69510f1131aa Diff from another changeset...

 
172
173
174
 
 
 
 
175
176
177
178
 
 
179
180
181
 
172
173
174
175
176
177
178
179
180
 
 
181
182
183
184
185
@@ -172,10 +172,14 @@
  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): - cpath = cpath[len(cwd+os.sep):] + if cpath.startswith(cwd_rel): + cpath = cpath[len(cwd_rel):]   self.files.append(cpath)   else:   self.files.append(f)
 
213
214
215
 
216
217
218
219
 
 
220
221
222
 
213
214
215
216
217
218
 
 
219
220
221
222
223
@@ -213,10 +213,11 @@
  if self.repo:   # Convert filenames to be relative to cwd   files = [] + cwd_rel = cwd[len(repo.root+os.sep):]   for f in self.fnames:   cpath = util.canonpath(self.repo.root, cwd, f) - if cpath.startswith(cwd): - cpath = cpath[len(cwd+os.sep):] + if cpath.startswith(cwd_rel): + cpath = cpath[len(cwd_rel):]   files.append(cpath)   else:   files.append(f)