changeset 8104:fd7cc930ab8f

Merge with crew-stable
author Matt Mackall <mpm@selenic.com>
date Fri, 17 Apr 2009 11:16:50 -0500
parents 6ea0318daf75 (diff) 66d0a03d3afc (current diff)
children 0019be957555
files
diffstat 7 files changed, 45 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/churn.py	Thu Apr 09 14:32:44 2009 +0200
+++ b/hgext/churn.py	Fri Apr 17 11:16:50 2009 -0500
@@ -21,9 +21,10 @@
     t.use_template(tmpl)
     return t
 
-def changedlines(ui, repo, ctx1, ctx2):
+def changedlines(ui, repo, ctx1, ctx2, fns):
     lines = 0
-    diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node()))
+    fmatch = cmdutil.match(repo, pats=fns)
+    diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch))
     for l in diff.split('\n'):
         if (l.startswith("+") and not l.startswith("+++ ") or
             l.startswith("-") and not l.startswith("--- ")):
@@ -71,7 +72,7 @@
                 continue
 
             ctx1 = parents[0]
-            lines = changedlines(ui, repo, ctx1, ctx)
+            lines = changedlines(ui, repo, ctx1, ctx, fns)
             rate[key] = rate.get(key, 0) + lines
 
         if opts.get('progress'):
--- a/mercurial/help.py	Thu Apr 09 14:32:44 2009 +0200
+++ b/mercurial/help.py	Fri Apr 17 11:16:50 2009 -0500
@@ -178,7 +178,7 @@
     revisions.
 
     A plain integer is treated as a revision number. Negative
-    integers are treated as toplogical offsets from the tip, with
+    integers are treated as topological offsets from the tip, with
     -1 denoting the tip. As such, negative numbers are only useful
     if you've memorized your local tree numbers and want to save
     typing a single digit. This editor suggests copy and paste.
--- a/mercurial/patch.py	Thu Apr 09 14:32:44 2009 +0200
+++ b/mercurial/patch.py	Fri Apr 17 11:16:50 2009 -0500
@@ -910,7 +910,7 @@
                 # else error?
                 # copy/rename + modify should modify target, not source
                 gp = changed.get(bfile)
-                if gp and gp.op in ('COPY', 'DELETE', 'RENAME'):
+                if gp and gp.op in ('COPY', 'DELETE', 'RENAME', 'ADD'):
                     afile = bfile
                     gitworkdone = True
             newfile = True
--- a/tests/test-churn	Thu Apr 09 14:32:44 2009 +0200
+++ b/tests/test-churn	Fri Apr 17 11:16:50 2009 -0500
@@ -20,7 +20,15 @@
 hg ci -m changeca -u user3 -d 12:00 a
 hg ci -m changecb -u user3 -d 12:15 b
 hg ci -Am addc -u user3 -d 12:30
+mkdir -p d/e
+echo abc > d/e/f1.txt
+hg ci -Am "add d/e/f1.txt" -u user1 -d 12:45 d/e/f1.txt
+mkdir -p d/g
+echo def > d/g/f2.txt
+hg ci -Am "add d/g/f2.txt" -u user1 -d 13:00 d/g/f2.txt
 
+echo % churn separate directories
+hg churn d/e
 echo % churn all
 hg churn
 echo % churn up to rev 2
--- a/tests/test-churn.out	Thu Apr 09 14:32:44 2009 +0200
+++ b/tests/test-churn.out	Fri Apr 17 11:16:50 2009 -0500
@@ -2,22 +2,25 @@
 adding a
 adding b
 adding c
+% churn separate directories
+user1      1 ***************************************************************
 % churn all
 user3      3 ***************************************************************
+user1      3 ***************************************************************
 user2      2 ******************************************
-user1      1 *********************
 % churn up to rev 2
 user2      2 ***************************************************************
 user1      1 *******************************
 % churn with aliases
 alias3      3 **************************************************************
+alias1      3 **************************************************************
 user2       2 *****************************************
-alias1      1 ********************
 % churn with column specifier
 user3      3 ***********************
+user1      3 ***********************
 user2      2 ***************
-user1      1 *******
 % churn by hour
-06      1 **********************
-09      2 ********************************************
-12      3 ******************************************************************
+06      1 ****************
+09      2 *********************************
+12      4 ******************************************************************
+13      1 ****************
--- a/tests/test-import	Thu Apr 09 14:32:44 2009 +0200
+++ b/tests/test-import	Fri Apr 17 11:16:50 2009 -0500
@@ -313,3 +313,22 @@
 hg import --no-commit -v -s 100 ../rename.diff
 hg st -C
 cd ..
+
+
+echo '% add empty file from the end of patch (issue 1495)'
+hg init addemptyend
+cd addemptyend
+touch a
+hg addremove
+hg ci -m "commit"
+cat > a.patch <<EOF
+diff --git a/a b/a
+--- a/a
++++ b/a
+@@ -0,0 +1,1 @@
++a
+diff --git a/b b/b
+new file mode 100644
+EOF
+hg import --no-commit a.patch
+cd ..
--- a/tests/test-import.out	Thu Apr 09 14:32:44 2009 +0200
+++ b/tests/test-import.out	Fri Apr 17 11:16:50 2009 -0500
@@ -293,3 +293,6 @@
 adding b
 A b
 R a
+% add empty file from the end of patch (issue 1495)
+adding a
+applying a.patch