equal
deleted
inserted
replaced
79 return ret |
79 return ret |
80 else: |
80 else: |
81 return arg |
81 return arg |
82 |
82 |
83 def wrap(func): |
83 def wrap(func): |
84 |
84 |
85 def wrapped(*args): |
85 def wrapped(*args): |
86 # check argument is unicode, then call original |
86 # check argument is unicode, then call original |
87 for arg in args: |
87 for arg in args: |
88 if isinstance(arg, unicode): |
88 if isinstance(arg, unicode): |
89 return func(*args) |
89 return func(*args) |
120 global _ui |
120 global _ui |
121 if not _ui: |
121 if not _ui: |
122 from mercurial import ui |
122 from mercurial import ui |
123 _ui = ui.ui() |
123 _ui = ui.ui() |
124 os.path.join = wrap(os.path.join) |
124 os.path.join = wrap(os.path.join) |
125 os.path.split = wrap(os.path.split) |
125 os.path.split = wrap(os.path.split) |
126 os.path.splitext = wrap(os.path.splitext) |
126 os.path.splitext = wrap(os.path.splitext) |
127 os.path.splitunc = wrap(os.path.splitunc) |
127 os.path.splitunc = wrap(os.path.splitunc) |
128 os.path.normpath = wrap(os.path.normpath) |
128 os.path.normpath = wrap(os.path.normpath) |
129 os.path.normcase = wrap(os.path.normcase) |
129 os.path.normcase = wrap(os.path.normcase) |
130 os.makedirs = wrap(os.makedirs) |
130 os.makedirs = wrap(os.makedirs) |
132 util.splitpath = wrap(util.splitpath) |
132 util.splitpath = wrap(util.splitpath) |
133 |
133 |
134 def uninstall(): |
134 def uninstall(): |
135 # restore original functions. |
135 # restore original functions. |
136 os.path.join = unwrap(os.path.join) |
136 os.path.join = unwrap(os.path.join) |
137 os.path.split = unwrap(os.path.split) |
137 os.path.split = unwrap(os.path.split) |
138 os.path.splitext = unwrap(os.path.splitext) |
138 os.path.splitext = unwrap(os.path.splitext) |
139 os.path.splitunc = unwrap(os.path.splitunc) |
139 os.path.splitunc = unwrap(os.path.splitunc) |
140 os.path.normpath = unwrap(os.path.normpath) |
140 os.path.normpath = unwrap(os.path.normpath) |
141 os.path.normcase = unwrap(os.path.normcase) |
141 os.path.normcase = unwrap(os.path.normcase) |
142 os.makedirs = unwrap(os.makedirs) |
142 os.makedirs = unwrap(os.makedirs) |