view tests/test-mq-qimport.out @ 11988:8380ed691df8

util: add an interpolate() function to for replacing multiple values util.interpolate can be used to replace multiple items in a string all at once (and optionally apply a function to the replacement), without worrying about recursing: >>> import util >>> s = '$foo, $spam' >>> util.interpolate(r'\$', { 'foo': 'bar', 'spam': 'eggs' }, s) 'bar, eggs' >>> util.interpolate(r'\$', { 'foo': 'spam', 'spam': 'foo' }, s) 'spam, foo' >>> util.interpolate(r'\$', { 'foo': 'spam', 'spam': 'foo' }, s, lambda s: s.upper()) 'SPAM, FOO' The patch also changes filemerge.py to use this new function.
author Steve Losh <steve@stevelosh.com>
date Wed, 18 Aug 2010 18:18:26 -0400
parents aae1dd12fce6
children
line wrap: on
line source

% qimport non-existing-file
abort: unable to read file non-existing-file
% import email
adding email to series file
applying email
now at: email
% hg tip -v
changeset:   0:1a706973a7d8
tag:         email
tag:         qbase
tag:         qtip
tag:         tip
user:        Username in patch <test@example.net>
date:        Thu Jan 01 00:00:00 1970 +0000
files:       x
description:
First line of commit message.

More text in commit message.


popping email
patch queue now empty
% import URL
adding url.diff to series file
url.diff
% import patch that already exists
abort: patch "url.diff" already exists
applying url.diff
now at: url.diff
foo
popping url.diff
patch queue now empty
% qimport -f
adding url.diff to series file
applying url.diff
now at: url.diff
foo2
popping url.diff
patch queue now empty
% build diff with CRLF
adding b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
% qimport CRLF diff
adding b.diff to series file
applying b.diff
now at: b.diff
% try to import --push
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adding another.diff to series file
applying another.diff
now at: another.diff
patch b.diff finalized without changeset message
patch another.diff finalized without changeset message
popping 2.diff
patch queue now empty
% qimport -e
adding 2.diff to series file
% qimport -e --name newname oldexisitingpatch
renaming 2.diff to this-name-is-better
adding this-name-is-better to series file
this-name-is-better
url.diff
% qimport -e --name without --force
abort: patch "this-name-is-better" already exists
this-name-is-better
url.diff
% qimport -e --name with --force
renaming 3.diff to this-name-is-better
adding this-name-is-better to series file
this-name-is-better
url.diff