Mercurial > hg-stable
changeset 5953:e7f1be4bf40a
Permitting the import command to accept a --user option.
The prose section of the help text for the command already said that -u and -m
are accepted, but -u was not listed in the table of options, and did not work.
Useful when accepting patches from other people made by hg diff rather than hg
export. For completeness, also accepting -d DATE.
[CHANGES: rebased against d8878742a924, --no-commit option.]
author | Jesse Glick <jesse.glick@sun.com> |
---|---|
date | Fri, 25 Jan 2008 19:49:15 -0500 |
parents | 2e8eeb5bf29b |
children | 851402e53337 |
files | mercurial/commands.py tests/test-import tests/test-import.out |
diffstat | 3 files changed, 36 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Jan 25 16:24:00 2008 -0800 +++ b/mercurial/commands.py Fri Jan 25 19:49:15 2008 -0500 @@ -1529,7 +1529,8 @@ finally: files = patch.updatedir(ui, repo, files) if not opts.get('no_commit'): - n = repo.commit(files, message, user, date) + n = repo.commit(files, message, opts.get('user') or user, + opts.get('date') or date) if opts.get('exact'): if hex(n) != nodeid: repo.rollback() @@ -2901,8 +2902,9 @@ ('', 'exact', None, _('apply patch to the nodes from which it was generated')), ('', 'import-branch', None, - _('Use any branch information in patch (implied by --exact)'))] + commitopts, - _('hg import [-p NUM] [-m MESSAGE] [-f] PATCH...')), + _('Use any branch information in patch (implied by --exact)'))] + + commitopts + commitopts2, + _('hg import [OPTION]... PATCH...')), "incoming|in": (incoming, [('M', 'no-merges', None, _('do not show merges')),
--- a/tests/test-import Fri Jan 25 16:24:00 2008 -0800 +++ b/tests/test-import Fri Jan 25 19:49:15 2008 -0500 @@ -32,6 +32,13 @@ hg --cwd b import -mpatch ../tip.patch rm -r b +echo % import of plain diff with specific date and user +hg clone -r0 a b +hg --cwd a diff -r0:1 > tip.patch +hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch +hg -R b tip -pv +rm -r b + echo % import of plain diff should be ok with --no-commit hg clone -r0 a b hg --cwd a diff -r0:1 > tip.patch
--- a/tests/test-import.out Fri Jan 25 16:24:00 2008 -0800 +++ b/tests/test-import.out Fri Jan 25 19:49:15 2008 -0500 @@ -31,6 +31,30 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying ../tip.patch +% import of plain diff with specific date and user +requesting all changes +adding changesets +adding manifests +adding file changes +added 1 changesets with 2 changes to 2 files +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +applying ../tip.patch +changeset: 1:ca68f19f3a40 +tag: tip +user: user@nowhere.net +date: Thu Jan 01 00:00:01 1970 +0000 +files: a +description: +patch + + +diff -r 80971e65b431 -r ca68f19f3a40 a +--- a/a Thu Jan 01 00:00:00 1970 +0000 ++++ b/a Thu Jan 01 00:00:01 1970 +0000 +@@ -1,1 +1,2 @@ + line 1 ++line 2 + % import of plain diff should be ok with --no-commit requesting all changes adding changesets