view tests/test-keyword.out @ 12252:4481f8a93c7a stable

convert/darcs: handle non-ASCII metadata in darcs changelog (issue2354) Given a commit author or message with non-ASCII characters in a darcs repo, convert would raise a UnicodeEncodeError when adding changesets to the hg changelog. This happened because etree returns back unicode objects for any text it can't encode into ASCII. convert was passing these objects to changelog.add(), which would then attempt encoding.fromlocal() on them. This patch ensures converter_source.recode() is called on each piece of commit data returned by etree. (Also note that darcs is currently encoding agnostic and will print out whatever is in a patch's metadata byte-for-byte, even in the XML changelog.)
author Brodie Rao <brodie@bitheap.org>
date Fri, 10 Sep 2010 09:30:50 -0500
parents f5aa20e177c0
children
line wrap: on
line source

% hg kwdemo
[extensions]
keyword =
[keyword]
demo.txt = 
[keywordmaps]
Author = {author|user}
Date = {date|utcdate}
Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
Id = {file|basename},v {node|short} {date|utcdate} {author|user}
RCSFile = {file|basename},v
RCSfile = {file|basename},v
Revision = {node|short}
Source = {root}/{file},v
$Author: test $
$Date: 2000/00/00 00:00:00 $
$Header: /TMP/demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
$Id: demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
$RCSFile: demo.txt,v $
$RCSfile: demo.txt,v $
$Revision: xxxxxxxxxxxx $
$Source: /TMP/demo.txt,v $
[extensions]
keyword =
[keyword]
demo.txt = 
[keywordmaps]
Branch = {branches}
$Branch: demobranch $
% kwshrink should exit silently in empty/invalid repo
pulling from test-keyword.hg
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
% cat
expand $Id$
do not process $Id:
xxx $
ignore $Id$
% no kwfiles
% untracked candidates
k a
% addremove
adding a
adding b
% status
A a
A b
% default keyword expansion including commit hook
% interrupted commit should not change state or run commit hook
abort: empty commit message
% status
A a
A b
% commit
a
b
overwriting a expanding keywords
running hook commit.test: cp a hooktest
committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
% status
? hooktest
% identify
ef63ca68695b
% cat
expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
do not process $Id:
xxx $
ignore $Id$
% hg cat
expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
do not process $Id:
xxx $
ignore $Id$
a
% diff a hooktest
% removing commit hook from config
% bundle
2 changesets found
% notify on pull to check whether keywords stay as is in email
% ie. if patch.diff wrapper acts as it should
% pull from bundle
pulling from ../kw.hg
requesting all changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 3 changes to 3 files

diff -r 000000000000 -r a2392c293916 sym
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sym	Sat Feb 09 20:25:47 2008 +0100
@@ -0,0 +1,1 @@
+a
\ No newline at end of file

diff -r a2392c293916 -r ef63ca68695b a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/a	Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,3 @@
+expand $Id$
+do not process $Id:
+xxx $
diff -r a2392c293916 -r ef63ca68695b b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/b	Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+ignore $Id$
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% remove notify config
% touch
% status
% update
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% cat
expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
do not process $Id:
xxx $
ignore $Id$
% check whether expansion is filewise
% commit c
adding c
% force expansion
overwriting a expanding keywords
overwriting c expanding keywords
% compare changenodes in a c
expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
do not process $Id:
xxx $
$Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
tests for different changenodes
% record chunk
diff --git a/a b/a
2 hunks, 2 lines changed
examine changes to 'a'? [Ynsfdaq?] 
@@ -1,3 +1,4 @@
 expand $Id$
+foo
 do not process $Id:
 xxx $
record change 1/2 to 'a'? [Ynsfdaq?] 
@@ -2,2 +3,3 @@
 do not process $Id:
 xxx $
+bar
record change 2/2 to 'a'? [Ynsfdaq?] 

d17e03c92c97+ tip
M a
% cat modified file
expand $Id: a,v d17e03c92c97 1970/01/01 00:00:01 test $
foo
do not process $Id:
xxx $
bar
diff -r d17e03c92c97 a
--- a/a	Wed Dec 31 23:59:51 1969 -0000
@@ -2,3 +2,4 @@
 foo
 do not process $Id:
 xxx $
+bar
rolling back to revision 2 (undo commit)
% record file
diff --git a/a b/a
2 hunks, 2 lines changed
examine changes to 'a'? [Ynsfdaq?] 
@@ -1,3 +1,4 @@
 expand $Id$
+foo
 do not process $Id:
 xxx $
record change 1/2 to 'a'? [Ynsfdaq?] 
@@ -2,2 +3,3 @@
 do not process $Id:
 xxx $
+bar
record change 2/2 to 'a'? [Ynsfdaq?] 
% a should be clean
C a
rolling back to revision 2 (undo commit)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
% init --mq
% qimport
% commit --mq
% keywords should not be expanded in patch
# HG changeset patch
# User User Name <user@example.com>
# Date 1 0
# Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
# Parent  ef63ca68695bc9495032c6fda1350c71e6d256e9
cndiff

diff -r ef63ca68695b -r 40a904bbbe4c c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/c	Thu Jan 01 00:00:01 1970 +0000
@@ -0,0 +1,2 @@
+$Id$
+tests for different changenodes
% qpop
popping mqtest.diff
patch queue now empty
% qgoto - should imply qpush
applying mqtest.diff
now at: mqtest.diff
% cat
$Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
tests for different changenodes
% hg cat
$Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
tests for different changenodes
% keyword should not be expanded in filelog
$Id$
tests for different changenodes
% qpop and move on
popping mqtest.diff
patch queue now empty
% copy
% kwfiles added
a
c
% commit
c
 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
overwriting c expanding keywords
committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
% cat a c
expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
do not process $Id:
xxx $
expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
do not process $Id:
xxx $
% touch copied c
% status
% kwfiles
a
c
% ignored files
I b
I sym
% all files
K a
K c
I b
I sym
% diff --rev
diff -r ef63ca68695b c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,3 @@
+expand $Id$
+do not process $Id:
+xxx $
% rollback
rolling back to revision 1 (undo commit)
% status
A c
% update -C
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
% custom keyword expansion
% try with kwdemo
[extensions]
keyword =
[keyword]
** = 
b = ignore
demo.txt = 
[keywordmaps]
Xinfo = {author}: {desc}
$Xinfo: test: hg keyword configuration and expansion example $
% cat
expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
do not process $Id:
xxx $
ignore $Id$
% hg cat
expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
do not process $Id:
xxx $
ignore $Id$
a
% interrupted commit should not change state
abort: empty commit message
% status
M a
? c
? log
% commit
a
overwriting a expanding keywords
committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
% status
? c
% verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
3 files, 3 changesets, 4 total revisions
% cat
expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: firstline $
ignore $Id$
% hg cat
expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: firstline $
ignore $Id$
a
% annotate
1: expand $Id$
1: do not process $Id:
1: xxx $
2: $Xinfo$
% remove
committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
% status
? c
% rollback
rolling back to revision 2 (undo commit)
% status
R a
? c
% revert a
% cat a
expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: firstline $
% clone
% expansion in dest
expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: firstline $
% no expansion in dest
expand $Id$
do not process $Id:
xxx $
$Xinfo$
% clone to test incoming
requesting all changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 3 changes to 3 files
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% incoming
comparing with test-keyword/Test
searching for changes
changeset:   2:bb948857c743
tag:         tip
user:        User Name <user@example.com>
date:        Thu Jan 01 00:00:02 1970 +0000
summary:     firstline

% commit rejecttest
a
overwriting a expanding keywords
committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
% export
% import
applying ../rejecttest.diff
% cat
expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
do not process $Id: rejecttest
xxx $
$Xinfo: User Name <user@example.com>: rejects? $
ignore $Id$

% rollback
rolling back to revision 2 (undo commit)
% clean update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
% kwexpand/kwshrink on selected files
% copy a x/a
% kwexpand a
overwriting a expanding keywords
% kwexpand x/a should abort
abort: outstanding uncommitted changes
x/a
 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
overwriting x/a expanding keywords
committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
% cat a
expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: xa $
% kwshrink a inside directory x
overwriting x/a shrinking keywords
% cat a
expand $Id$
do not process $Id:
xxx $
$Xinfo$
% kwexpand nonexistent
nonexistent:
% hg serve
% expansion
% hgweb file
200 Script output follows

expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: firstline $
% no expansion
% hgweb annotate
200 Script output follows


user@1: expand $Id$
user@1: do not process $Id:
user@1: xxx $
user@2: $Xinfo$




% hgweb changeset
200 Script output follows


# HG changeset patch
# User User Name <user@example.com>
# Date 3 0
# Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
# Parent  bb948857c743469b22bbf51f7ec8112279ca5d83
xa

diff -r bb948857c743 -r b4560182a3f9 x/a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/x/a	Thu Jan 01 00:00:03 1970 +0000
@@ -0,0 +1,4 @@
+expand $Id$
+do not process $Id:
+xxx $
+$Xinfo$

% hgweb filediff
200 Script output follows


diff -r ef63ca68695b -r bb948857c743 a
--- a/a	Thu Jan 01 00:00:00 1970 +0000
+++ b/a	Thu Jan 01 00:00:02 1970 +0000
@@ -1,3 +1,4 @@
 expand $Id$
 do not process $Id:
 xxx $
+$Xinfo$




% errors encountered
% merge/resolve
% simplemerge
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
foo
% conflict
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
merging m
warning: conflicts during merge.
merging m failed!
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
% keyword stays outside conflict zone
$Id$
<<<<<<< local
bar
=======
foo
>>>>>>> other
% resolve to local
$Id: m 41efa6d38e9b Thu, 01 Jan 1970 00:00:00 +0000 test $
bar
% test restricted mode with transplant -b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch foo
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
applying 4aa30d025d50
4aa30d025d50 transplanted to 5a4da427c162
% no expansion in changeset
changeset:   11:5a4da427c162
tag:         tip
parent:      9:41efa6d38e9b
user:        test
date:        Thu Jan 01 00:00:00 1970 +0000
summary:     9foobranch

diff -r 41efa6d38e9b -r 5a4da427c162 a
--- a/a	Thu Jan 01 00:00:00 1970 +0000
+++ b/a	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +1,4 @@
+foobranch
 expand $Id$
 do not process $Id:
 xxx $

% expansion in file
foobranch
expand $Id: a 5a4da427c162 Thu, 01 Jan 1970 00:00:00 +0000 test $
% switch off expansion
% kwshrink with unknown file u
overwriting a shrinking keywords
overwriting m shrinking keywords
overwriting x/a shrinking keywords
% cat
expand $Id$
do not process $Id:
xxx $
$Xinfo$
ignore $Id$
% hg cat
expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
do not process $Id:
xxx $
$Xinfo: User Name <user@example.com>: firstline $
ignore $Id$
a
% cat
expand $Id$
do not process $Id:
xxx $
$Xinfo$
ignore $Id$
% hg cat
expand $Id$
do not process $Id:
xxx $
$Xinfo$
ignore $Id$
a