comparison mercurial/commands.py @ 966:022bcc738389

hg import: abort with uncommitted changes, override with --force
author mpm@selenic.com
date Fri, 19 Aug 2005 23:07:31 -0800
parents a425123e6afe
children 1f3710636b45
comparison
equal deleted inserted replaced
965:a425123e6afe 966:022bcc738389
734 ui.write("%s\n" % ' '.join(output)) 734 ui.write("%s\n" % ' '.join(output))
735 735
736 def import_(ui, repo, patch1, *patches, **opts): 736 def import_(ui, repo, patch1, *patches, **opts):
737 """import an ordered set of patches""" 737 """import an ordered set of patches"""
738 patches = (patch1,) + patches 738 patches = (patch1,) + patches
739
740 if not opts['force']:
741 (c, a, d, u) = repo.changes()
742 if c or a or d:
743 ui.warn("abort: outstanding uncommitted changes!\n")
744 return 1
739 745
740 d = opts["base"] 746 d = opts["base"]
741 strip = opts["strip"] 747 strip = opts["strip"]
742 748
743 for patch in patches: 749 for patch in patches:
1327 "help": (help_, [], 'hg help [COMMAND]'), 1333 "help": (help_, [], 'hg help [COMMAND]'),
1328 "identify|id": (identify, [], 'hg identify'), 1334 "identify|id": (identify, [], 'hg identify'),
1329 "import|patch": 1335 "import|patch":
1330 (import_, 1336 (import_,
1331 [('p', 'strip', 1, 'path strip'), 1337 [('p', 'strip', 1, 'path strip'),
1338 ('f', 'force', None, 'skip check for outstanding changes'),
1332 ('b', 'base', "", 'base path')], 1339 ('b', 'base', "", 'base path')],
1333 "hg import [-p NUM] [-b BASE] PATCH..."), 1340 "hg import [-p NUM] [-b BASE] PATCH..."),
1334 "incoming|in": (incoming, [], 'hg incoming [SOURCE]'), 1341 "incoming|in": (incoming, [], 'hg incoming [SOURCE]'),
1335 "^init": (init, [], 'hg init [DEST]'), 1342 "^init": (init, [], 'hg init [DEST]'),
1336 "locate": 1343 "locate":