154 The default is the basename of the archive, with suffixes removed. |
154 The default is the basename of the archive, with suffixes removed. |
155 ''' |
155 ''' |
156 |
156 |
157 ctx = repo[opts.get('rev')] |
157 ctx = repo[opts.get('rev')] |
158 if not ctx: |
158 if not ctx: |
159 raise util.Abort(_('repository has no revisions')) |
159 raise util.Abort(_('no working directory: please specify a revision')) |
160 node = ctx.node() |
160 node = ctx.node() |
161 dest = cmdutil.make_filename(repo, dest, node) |
161 dest = cmdutil.make_filename(repo, dest, node) |
162 if os.path.realpath(dest) == repo.root: |
162 if os.path.realpath(dest) == repo.root: |
163 raise util.Abort(_('repository root cannot be destination')) |
163 raise util.Abort(_('repository root cannot be destination')) |
164 matchfn = cmdutil.match(repo, [], opts) |
164 matchfn = cmdutil.match(repo, [], opts) |
2328 return cmdutil.copy(ui, repo, pats, opts, rename=True) |
2328 return cmdutil.copy(ui, repo, pats, opts, rename=True) |
2329 finally: |
2329 finally: |
2330 del wlock |
2330 del wlock |
2331 |
2331 |
2332 def resolve(ui, repo, *pats, **opts): |
2332 def resolve(ui, repo, *pats, **opts): |
2333 """resolve file merges from a branch merge or update |
2333 """retry file merges from a merge or update |
2334 |
2334 |
2335 This command will attempt to resolve unresolved merges from the |
2335 This command will cleanly retry unresolved file merges using file |
2336 last update or merge command. This will use the local file |
2336 revisions preserved from the last update or merge. To attempt to |
2337 revision preserved at the last update or merge to cleanly retry |
2337 resolve all unresolved files, use the -a switch. |
2338 the file merge attempt. With no file or options specified, this |
2338 |
2339 command will attempt to resolve all unresolved files. |
2339 This command will also allow listing resolved files and manually |
|
2340 marking and unmarking files as resolved. |
2340 |
2341 |
2341 The codes used to show the status of files are: |
2342 The codes used to show the status of files are: |
2342 U = unresolved |
2343 U = unresolved |
2343 R = resolved |
2344 R = resolved |
2344 """ |
2345 """ |
2345 |
2346 |
2346 if len([x for x in opts if opts[x]]) > 1: |
2347 all, mark, unmark, show = [opts.get(o) for o in 'all mark unmark list'.split()] |
|
2348 |
|
2349 if (show and (mark or unmark)) or (mark and unmark): |
2347 raise util.Abort(_("too many options specified")) |
2350 raise util.Abort(_("too many options specified")) |
|
2351 if pats and all: |
|
2352 raise util.Abort(_("can't specify --all and patterns")) |
|
2353 if not (all or pats or show or mark or unmark): |
|
2354 raise util.Abort(_('no files or directories specified; ' |
|
2355 'use --all to remerge all files')) |
2348 |
2356 |
2349 ms = merge_.mergestate(repo) |
2357 ms = merge_.mergestate(repo) |
2350 m = cmdutil.match(repo, pats, opts) |
2358 m = cmdutil.match(repo, pats, opts) |
2351 |
2359 |
2352 for f in ms: |
2360 for f in ms: |
2353 if m(f): |
2361 if m(f): |
2354 if opts.get("list"): |
2362 if show: |
2355 ui.write("%s %s\n" % (ms[f].upper(), f)) |
2363 ui.write("%s %s\n" % (ms[f].upper(), f)) |
2356 elif opts.get("mark"): |
2364 elif mark: |
2357 ms.mark(f, "r") |
2365 ms.mark(f, "r") |
2358 elif opts.get("unmark"): |
2366 elif unmark: |
2359 ms.mark(f, "u") |
2367 ms.mark(f, "u") |
2360 else: |
2368 else: |
2361 wctx = repo[None] |
2369 wctx = repo[None] |
2362 mctx = wctx.parents()[-1] |
2370 mctx = wctx.parents()[-1] |
2363 ms.resolve(f, wctx, mctx) |
2371 ms.resolve(f, wctx, mctx) |
3313 _('forcibly copy over an existing managed file')), |
3321 _('forcibly copy over an existing managed file')), |
3314 ] + walkopts + dryrunopts, |
3322 ] + walkopts + dryrunopts, |
3315 _('[OPTION]... SOURCE... DEST')), |
3323 _('[OPTION]... SOURCE... DEST')), |
3316 "resolve": |
3324 "resolve": |
3317 (resolve, |
3325 (resolve, |
3318 [('l', 'list', None, _('list state of files needing merge')), |
3326 [('a', 'all', None, _('remerge all unresolved files')), |
|
3327 ('l', 'list', None, _('list state of files needing merge')), |
3319 ('m', 'mark', None, _('mark files as resolved')), |
3328 ('m', 'mark', None, _('mark files as resolved')), |
3320 ('u', 'unmark', None, _('unmark files as resolved'))], |
3329 ('u', 'unmark', None, _('unmark files as resolved'))], |
3321 _('[OPTION]... [FILE]...')), |
3330 _('[OPTION]... [FILE]...')), |
3322 "revert": |
3331 "revert": |
3323 (revert, |
3332 (revert, |