Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 22296:650b5b6e75ed
convert: use None value for missing files instead of overloading IOError
The internal API used IOError to indicate that a file should be marked as
removed.
There is some correlation between IOError (especially with ENOENT) and files
that should be removed, but using IOErrors to represent file removal internally
required some hacks.
Instead, use the value None to indicate that the file not is present.
Before, spurious IO errors could cause commits that silently removed files.
They will now be reported like all other IO errors so the root cause can be
fixed.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 26 Aug 2014 22:03:32 +0200 |
parents | ffaaa80fa724 |
children | bdc0e04df243 |
comparison
equal
deleted
inserted
replaced
22295:926bc0d3b595 | 22296:650b5b6e75ed |
---|---|
2128 islink='l' in flags, | 2128 islink='l' in flags, |
2129 isexec='x' in flags, | 2129 isexec='x' in flags, |
2130 copied=copied.get(path)) | 2130 copied=copied.get(path)) |
2131 return mctx | 2131 return mctx |
2132 except KeyError: | 2132 except KeyError: |
2133 raise IOError | 2133 return None |
2134 else: | 2134 else: |
2135 ui.note(_('copying changeset %s to %s\n') % (old, base)) | 2135 ui.note(_('copying changeset %s to %s\n') % (old, base)) |
2136 | 2136 |
2137 # Use version of files as in the old cset | 2137 # Use version of files as in the old cset |
2138 def filectxfn(repo, ctx_, path): | 2138 def filectxfn(repo, ctx_, path): |
2139 try: | 2139 try: |
2140 return old.filectx(path) | 2140 return old.filectx(path) |
2141 except KeyError: | 2141 except KeyError: |
2142 raise IOError | 2142 return None |
2143 | 2143 |
2144 user = opts.get('user') or old.user() | 2144 user = opts.get('user') or old.user() |
2145 date = opts.get('date') or old.date() | 2145 date = opts.get('date') or old.date() |
2146 editform = mergeeditform(old, 'commit.amend') | 2146 editform = mergeeditform(old, 'commit.amend') |
2147 editor = getcommiteditor(editform=editform, **opts) | 2147 editor = getcommiteditor(editform=editform, **opts) |