Show More
@@ -2234,9 +2234,11 b' def rename(ui, repo, *pats, **opts):' | |||||
2234 | def revert(ui, repo, *pats, **opts): |
|
2234 | def revert(ui, repo, *pats, **opts): | |
2235 | """revert modified files or dirs to their states as of some revision |
|
2235 | """revert modified files or dirs to their states as of some revision | |
2236 |
|
2236 | |||
2237 |
|
|
2237 | With no revision specified, revert the named files or directories | |
2238 |
they had in the parent of the working directory. |
|
2238 | to the contents they had in the parent of the working directory. | |
2239 |
the contents of the affected files to an unmodified |
|
2239 | This restores the contents of the affected files to an unmodified | |
|
2240 | state. If the working directory has two parents, you must | |||
|
2241 | explicitly specify the revision to revert to. | |||
2240 |
|
2242 | |||
2241 | Modified files are saved with a .orig suffix before reverting. |
|
2243 | Modified files are saved with a .orig suffix before reverting. | |
2242 | To disable these backups, use --no-backup. |
|
2244 | To disable these backups, use --no-backup. | |
@@ -2258,8 +2260,14 b' def revert(ui, repo, *pats, **opts):' | |||||
2258 |
|
2260 | |||
2259 | If no arguments are given, all files in the repository are reverted. |
|
2261 | If no arguments are given, all files in the repository are reverted. | |
2260 | """ |
|
2262 | """ | |
2261 |
parent = repo.dirstate.parents() |
|
2263 | parent, p2 = repo.dirstate.parents() | |
2262 | node = opts['rev'] and repo.lookup(opts['rev']) or parent |
|
2264 | if opts['rev']: | |
|
2265 | node = repo.lookup(opts['rev']) | |||
|
2266 | elif p2 != nullid: | |||
|
2267 | raise util.Abort(_('working dir has two parents; ' | |||
|
2268 | 'you must specify the revision to revert to')) | |||
|
2269 | else: | |||
|
2270 | node = parent | |||
2263 | mf = repo.manifest.read(repo.changelog.read(node)[0]) |
|
2271 | mf = repo.manifest.read(repo.changelog.read(node)[0]) | |
2264 |
|
2272 | |||
2265 | wlock = repo.wlock() |
|
2273 | wlock = repo.wlock() |
General Comments 0
You need to be logged in to leave comments.
Login now