1242 |
1242 |
1243 NOTE: This command should be treated as experimental. While it |
1243 NOTE: This command should be treated as experimental. While it |
1244 should properly record copied files, this information is not yet |
1244 should properly record copied files, this information is not yet |
1245 fully used by merge, nor fully reported by log. |
1245 fully used by merge, nor fully reported by log. |
1246 """ |
1246 """ |
1247 try: |
1247 wlock = repo.wlock(0) |
1248 wlock = repo.wlock(0) |
1248 errs, copied = docopy(ui, repo, pats, opts, wlock) |
1249 errs, copied = docopy(ui, repo, pats, opts, wlock) |
|
1250 except lock.LockHeld, inst: |
|
1251 ui.warn(_("repository lock held by %s\n") % inst.args[0]) |
|
1252 errs = 1 |
|
1253 return errs |
1249 return errs |
1254 |
1250 |
1255 def debugancestor(ui, index, rev1, rev2): |
1251 def debugancestor(ui, index, rev1, rev2): |
1256 """find the ancestor revision of two revisions in a given index""" |
1252 """find the ancestor revision of two revisions in a given index""" |
1257 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "") |
1253 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "") |
2254 |
2250 |
2255 NOTE: This command should be treated as experimental. While it |
2251 NOTE: This command should be treated as experimental. While it |
2256 should properly record rename files, this information is not yet |
2252 should properly record rename files, this information is not yet |
2257 fully used by merge, nor fully reported by log. |
2253 fully used by merge, nor fully reported by log. |
2258 """ |
2254 """ |
2259 try: |
2255 wlock = repo.wlock(0) |
2260 wlock = repo.wlock(0) |
2256 errs, copied = docopy(ui, repo, pats, opts, wlock) |
2261 errs, copied = docopy(ui, repo, pats, opts, wlock) |
2257 names = [] |
2262 names = [] |
2258 for abs, rel, exact in copied: |
2263 for abs, rel, exact in copied: |
2259 if ui.verbose or not exact: |
2264 if ui.verbose or not exact: |
2260 ui.status(_('removing %s\n') % rel) |
2265 ui.status(_('removing %s\n') % rel) |
2261 names.append(abs) |
2266 names.append(abs) |
2262 repo.remove(names, True, wlock) |
2267 repo.remove(names, True, wlock) |
|
2268 except lock.LockHeld, inst: |
|
2269 ui.warn(_("repository lock held by %s\n") % inst.args[0]) |
|
2270 errs = 1 |
|
2271 return errs |
2263 return errs |
2272 |
2264 |
2273 def revert(ui, repo, *pats, **opts): |
2265 def revert(ui, repo, *pats, **opts): |
2274 """revert modified files or dirs back to their unmodified states |
2266 """revert modified files or dirs back to their unmodified states |
2275 |
2267 |
3250 u.warn(_("hg: unknown command '%s'\n") % inst.args[0]) |
3242 u.warn(_("hg: unknown command '%s'\n") % inst.args[0]) |
3251 help_(u, 'shortlist') |
3243 help_(u, 'shortlist') |
3252 sys.exit(1) |
3244 sys.exit(1) |
3253 except hg.RepoError, inst: |
3245 except hg.RepoError, inst: |
3254 u.warn(_("abort: "), inst, "!\n") |
3246 u.warn(_("abort: "), inst, "!\n") |
|
3247 except lock.LockHeld, inst: |
|
3248 if inst.errno == errno.ETIMEDOUT: |
|
3249 reason = _('timed out waiting for lock held by %s') % inst.locker |
|
3250 else: |
|
3251 reason = _('lock held by %s') % inst.locker |
|
3252 u.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) |
|
3253 except lock.LockUnavailable, inst: |
|
3254 u.warn(_("abort: could not lock %s: %s\n") % |
|
3255 (inst.desc or inst.filename, inst.strerror)) |
3255 except revlog.RevlogError, inst: |
3256 except revlog.RevlogError, inst: |
3256 u.warn(_("abort: "), inst, "!\n") |
3257 u.warn(_("abort: "), inst, "!\n") |
3257 except SignalInterrupt: |
3258 except SignalInterrupt: |
3258 u.warn(_("killed!\n")) |
3259 u.warn(_("killed!\n")) |
3259 except KeyboardInterrupt: |
3260 except KeyboardInterrupt: |