# HG changeset patch # User mpm@selenic.com # Date 2005-08-20 07:07:31 # Node ID 022bcc738389ebb45973a550521a987b6c3c97e4 # Parent a425123e6afe3f370a55e051278bcb38d1b6c7eb hg import: abort with uncommitted changes, override with --force diff --git a/doc/hg.1.txt b/doc/hg.1.txt --- a/doc/hg.1.txt +++ b/doc/hg.1.txt @@ -188,13 +188,14 @@ identify:: aliases: id -import [-p -b -q] :: +import [-p -b -f] :: Import a list of patches and commit them individually. options: -p, --strip directory strip option for patch. This has the same meaning as the correnponding patch option -b base directory to read patches from + -f, --force skip check for outstanding uncommitted changes aliases: patch diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -737,6 +737,12 @@ def import_(ui, repo, patch1, *patches, """import an ordered set of patches""" patches = (patch1,) + patches + if not opts['force']: + (c, a, d, u) = repo.changes() + if c or a or d: + ui.warn("abort: outstanding uncommitted changes!\n") + return 1 + d = opts["base"] strip = opts["strip"] @@ -1329,6 +1335,7 @@ table = { "import|patch": (import_, [('p', 'strip', 1, 'path strip'), + ('f', 'force', None, 'skip check for outstanding changes'), ('b', 'base', "", 'base path')], "hg import [-p NUM] [-b BASE] PATCH..."), "incoming|in": (incoming, [], 'hg incoming [SOURCE]'),