equal
deleted
inserted
replaced
97 Returns 0 on success. |
97 Returns 0 on success. |
98 """ |
98 """ |
99 if opts.get('follow'): |
99 if opts.get('follow'): |
100 # --follow is deprecated and now just an alias for -f/--file |
100 # --follow is deprecated and now just an alias for -f/--file |
101 # to mimic the behavior of Mercurial before version 1.5 |
101 # to mimic the behavior of Mercurial before version 1.5 |
102 opts['file'] = 1 |
102 opts['file'] = True |
103 |
103 |
104 datefunc = ui.quiet and util.shortdate or util.datestr |
104 datefunc = ui.quiet and util.shortdate or util.datestr |
105 getdate = util.cachefunc(lambda x: datefunc(x[0].date())) |
105 getdate = util.cachefunc(lambda x: datefunc(x[0].date())) |
106 |
106 |
107 if not pats: |
107 if not pats: |
114 ('file', lambda x: x[0].path()), |
114 ('file', lambda x: x[0].path()), |
115 ] |
115 ] |
116 |
116 |
117 if (not opts.get('user') and not opts.get('changeset') |
117 if (not opts.get('user') and not opts.get('changeset') |
118 and not opts.get('date') and not opts.get('file')): |
118 and not opts.get('date') and not opts.get('file')): |
119 opts['number'] = 1 |
119 opts['number'] = True |
120 |
120 |
121 linenumber = opts.get('line_number') is not None |
121 linenumber = opts.get('line_number') is not None |
122 if linenumber and (not opts.get('changeset')) and (not opts.get('number')): |
122 if linenumber and (not opts.get('changeset')) and (not opts.get('number')): |
123 raise util.Abort(_('at least one of -n/-c is required for -l')) |
123 raise util.Abort(_('at least one of -n/-c is required for -l')) |
124 |
124 |
3618 if not opts.get('dry_run'): |
3618 if not opts.get('dry_run'): |
3619 def checkout(f): |
3619 def checkout(f): |
3620 fc = ctx[f] |
3620 fc = ctx[f] |
3621 repo.wwrite(f, fc.data(), fc.flags()) |
3621 repo.wwrite(f, fc.data(), fc.flags()) |
3622 |
3622 |
3623 audit_path = scmutil.path_auditor(repo.root) |
3623 audit_path = scmutil.pathauditor(repo.root) |
3624 for f in remove[0]: |
3624 for f in remove[0]: |
3625 if repo.dirstate[f] == 'a': |
3625 if repo.dirstate[f] == 'a': |
3626 repo.dirstate.forget(f) |
3626 repo.dirstate.forget(f) |
3627 continue |
3627 continue |
3628 audit_path(f) |
3628 audit_path(f) |