Merge with macencode branch
authorPatrick Mezard <pmezard@gmail.com>
Sat, 05 Apr 2008 19:33:34 +0200
changeset 6484 ab8038bf5127
parent 6480 ee7762515a41 (diff)
parent 6483 0a803195bb29 (current diff)
child 6485 938319418d8c
Merge with macencode branch
hgext/win32text.py
--- a/contrib/dumprevlog	Sat Apr 05 19:06:16 2008 +0200
+++ b/contrib/dumprevlog	Sat Apr 05 19:33:34 2008 +0200
@@ -3,10 +3,14 @@
 # $ find .hg/store/ -name "*.i" | xargs dumprevlog > repo.dump
 
 import sys
-from mercurial import revlog, node
+from mercurial import revlog, node, util
+
+for fp in (sys.stdin, sys.stdout, sys.stderr):
+    util.set_binary(fp)
 
 for f in sys.argv[1:]:
-    r = revlog.revlog(open, f)
+    binopen = lambda fn: open(fn, 'rb')
+    r = revlog.revlog(binopen, f)
     print "file:", f
     for i in xrange(r.count()):
         n = r.node(i)
--- a/contrib/undumprevlog	Sat Apr 05 19:06:16 2008 +0200
+++ b/contrib/undumprevlog	Sat Apr 05 19:33:34 2008 +0200
@@ -6,6 +6,9 @@
 import sys
 from mercurial import revlog, node, util, transaction
 
+for fp in (sys.stdin, sys.stdout, sys.stderr):
+    util.set_binary(fp)
+
 opener = util.opener('.', False)
 tr = transaction.transaction(sys.stderr.write, opener, "undump.journal")
 while 1:
--- a/hgext/patchbomb.py	Sat Apr 05 19:06:16 2008 +0200
+++ b/hgext/patchbomb.py	Sat Apr 05 19:33:34 2008 +0200
@@ -64,10 +64,9 @@
 #
 # That should be all.  Now your patchbomb is on its way out.
 
-import os, errno, socket, tempfile
+import os, errno, socket, tempfile, cStringIO
 import email.MIMEMultipart, email.MIMEText, email.MIMEBase
 import email.Utils, email.Encoders, email.Generator
-import cStringIO.StringIO
 from mercurial import cmdutil, commands, hg, mail, patch, util
 from mercurial.i18n import _
 from mercurial.node import bin
--- a/hgext/win32text.py	Sat Apr 05 19:06:16 2008 +0200
+++ b/hgext/win32text.py	Sat Apr 05 19:33:34 2008 +0200
@@ -27,7 +27,6 @@
 # pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
 # # or pretxnchangegroup.cr = python:hgext.win32text.forbidcr
 
-from mercurial import util
 from mercurial.i18n import gettext as _
 from mercurial.node import bin, short
 import re
@@ -65,25 +64,29 @@
 def macdumbencode(s, cmd):
     return s.replace('\r', '\n')
 
+def clevertest(s, cmd):
+    if '\0' in s: return False
+    return True
+
 def cleverdecode(s, cmd, **kwargs):
-    if util.binary(s):
-        return s
-    return dumbdecode(s, cmd, **kwargs)
+    if clevertest(s, cmd):
+        return dumbdecode(s, cmd, **kwargs)
+    return s
 
 def cleverencode(s, cmd):
-    if util.binary(s):
-        return s
-    return dumbencode(s, cmd)
+    if clevertest(s, cmd):
+        return dumbencode(s, cmd)
+    return s
 
 def macdecode(s, cmd, **kwargs):
-    if util.binary(s):
-        return s
-    return macdumbdecode(s, cmd, **kwargs)
+    if clevertest(s, cmd):
+        return macdumbdecode(s, cmd, **kwargs)
+    return s
 
 def macencode(s, cmd):
-    if util.binary(s):
-        return s
-    return macdumbencode(s, cmd)
+    if clevertest(s, cmd):
+        return macdumbencode(s, cmd)
+    return s
 
 _filters = {
     'dumbdecode:': dumbdecode,
@@ -104,7 +107,7 @@
             if f not in c:
                 continue
             data = c[f].data()
-            if not util.binary(data) and newline in data:
+            if '\0' not in data and newline in data:
                 if not halt:
                     ui.warn(_('Attempt to commit or push text file(s) '
                               'using %s line endings\n') %
--- a/mercurial/dirstate.py	Sat Apr 05 19:06:16 2008 +0200
+++ b/mercurial/dirstate.py	Sat Apr 05 19:33:34 2008 +0200
@@ -407,6 +407,8 @@
         return False
 
     def _dirignore(self, f):
+        if f == '.':
+            return False
         if self._ignore(f):
             return True
         for c in strutil.findall(f, '/'):
--- a/templates/coal/map	Sat Apr 05 19:06:16 2008 +0200
+++ b/templates/coal/map	Sat Apr 05 19:33:34 2008 +0200
@@ -20,8 +20,8 @@
 changeset = changeset.tmpl
 manifest = manifest.tmpl
 
-direntry = '<tr class="fileline parity{parity}"><td class="name"><img src="{staticurl}coal-folder.png"> <a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">{basename|escape}/</a><td class="size"></td><td class="permissions">drwxr-xr-x</td></tr>'
-fileentry = '<tr class="fileline parity{parity}"><td clase="filename"><img src="{staticurl}coal-file.png"> <a href="{url}file/{node|short}/{file|urlescape}#l1{sessionvars%urlparameter}">{basename|escape}</a></td><td class="size">{size}</td><td class="permissions">{permissions|permissions}</td></tr>'
+direntry = '<tr class="fileline parity{parity}"><td class="name"><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}"><img src="{staticurl}coal-folder.png"> {basename|escape}/</a><td class="size"></td><td class="permissions">drwxr-xr-x</td></tr>'
+fileentry = '<tr class="fileline parity{parity}"><td clase="filename"><a href="{url}file/{node|short}/{file|urlescape}#l1{sessionvars%urlparameter}"><img src="{staticurl}coal-file.png"> {basename|escape}</a></td><td class="size">{size}</td><td class="permissions">{permissions|permissions}</td></tr>'
 
 filerevision = filerevision.tmpl
 fileannotate = fileannotate.tmpl
Binary file templates/static/coal-file.png has changed
Binary file templates/static/coal-folder.png has changed
--- a/templates/static/style-coal.css	Sat Apr 05 19:06:16 2008 +0200
+++ b/templates/static/style-coal.css	Sat Apr 05 19:33:34 2008 +0200
@@ -27,7 +27,7 @@
   padding: 10px;
   width: 75px;
   margin: 0;
-  font-size: 80% /*smaller*/;
+  font-size: 80%;
   text-align: left;
   position: fixed;
   top: 27px;
@@ -50,17 +50,18 @@
 }
 
 .menu li.active {
-  border-left: 3px solid black;
+  background: black;
+  color: white;
 }
 
+.menu a { color: black; display: block; }
+
 .search {
   position: absolute;
   top: .7em;
   right: 2em;
 }
 
-.menu a { color: black; display: block; }
-
 a { text-decoration:none; }
 .age { white-space:nowrap; }
 .date { white-space:nowrap; }
@@ -128,6 +129,7 @@
 .bigtable td.annotate { font-size: smaller; }
 
 .fileline { font-family: monospace; }
+.fileline img { border: 0; }
 
 /* Changeset entry */
 #changesetEntry { 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-dumprevlog	Sat Apr 05 19:33:34 2008 +0200
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+CONTRIBDIR=$TESTDIR/../contrib
+
+mkdir repo-a
+cd repo-a
+hg init
+
+echo this is file a > a
+hg add a
+hg commit -m first -d '0 0'
+
+echo adding to file a >> a
+hg commit -m second -d '0 0'
+
+echo adding more to file a >> a
+hg commit -m third -d '0 0'
+
+hg verify
+
+echo dumping revlog of file a to stdout:
+python $CONTRIBDIR/dumprevlog .hg/store/data/a.i
+echo dumprevlog done
+
+# dump all revlogs to file repo.dump
+find .hg/store/ -name "*.i" | xargs python $CONTRIBDIR/dumprevlog > ../repo.dump
+
+cd ..
+
+mkdir repo-b
+cd repo-b
+hg init
+
+echo undumping:
+python $CONTRIBDIR/undumprevlog < ../repo.dump
+echo undumping done
+
+hg verify
+
+cd ..
+
+echo comparing repos:
+hg -R repo-b incoming repo-a
+hg -R repo-a incoming repo-b
+echo comparing done
+
+exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-dumprevlog.out	Sat Apr 05 19:33:34 2008 +0200
@@ -0,0 +1,53 @@
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+1 files, 3 changesets, 3 total revisions
+dumping revlog of file a to stdout:
+file: .hg/store/data/a.i
+node: 183d2312b35066fb6b3b449b84efc370d50993d0
+linkrev: 0
+parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
+length: 15
+-start-
+this is file a
+
+-end-
+node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b
+linkrev: 1
+parents: 183d2312b35066fb6b3b449b84efc370d50993d0 0000000000000000000000000000000000000000
+length: 32
+-start-
+this is file a
+adding to file a
+
+-end-
+node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1
+linkrev: 2
+parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b 0000000000000000000000000000000000000000
+length: 54
+-start-
+this is file a
+adding to file a
+adding more to file a
+
+-end-
+dumprevlog done
+undumping:
+.hg/store/data/a.i
+.hg/store/00manifest.i
+.hg/store/00changelog.i
+undumping done
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+1 files, 3 changesets, 3 total revisions
+comparing repos:
+comparing with repo-a
+searching for changes
+no changes found
+comparing with repo-b
+searching for changes
+no changes found
+comparing done
--- a/tests/test-hgignore	Sat Apr 05 19:06:16 2008 +0200
+++ b/tests/test-hgignore	Sat Apr 05 19:33:34 2008 +0200
@@ -40,6 +40,10 @@
 echo ".*\.o" > .hgignore
 echo "--" ; hg status
 
+# Check it does not ignore the current directory '.'
+echo "^\." > .hgignore
+echo "--" ; hg status
+
 echo "glob:**.o" > .hgignore
 echo "--" ; hg status
 
--- a/tests/test-hgignore.out	Sat Apr 05 19:06:16 2008 +0200
+++ b/tests/test-hgignore.out	Sat Apr 05 19:33:34 2008 +0200
@@ -15,6 +15,12 @@
 ? syntax
 --
 A dir/b.o
+? a.c
+? a.o
+? dir/c.o
+? syntax
+--
+A dir/b.o
 ? .hgignore
 ? a.c
 ? syntax