# HG changeset patch # User Benoit Boissinot # Date 1225111975 -3600 # Node ID 7e2e3aacc5dcebc33b1038a3577a25510dae3186 # Parent 671b3e1eac2ec3f75c7991fb6fbaf0f7a97b469f# Parent 3cbadcf28a4c194dc9605ddddff227489ec82a2b merge with dsop diff -r 3cbadcf28a4c -r 7e2e3aacc5dc hgext/convert/git.py --- a/hgext/convert/git.py Sun Oct 26 17:08:48 2008 +0800 +++ b/hgext/convert/git.py Mon Oct 27 13:52:55 2008 +0100 @@ -38,7 +38,7 @@ def getheads(self): if not self.rev: - return self.gitcmd('git rev-parse --branches').read().splitlines() + return self.gitcmd('git rev-parse --branches --remotes').read().splitlines() else: fh = self.gitcmd("git rev-parse --verify %s" % self.rev) return [fh.read()[:-1]] @@ -56,22 +56,26 @@ def getchanges(self, version): self.modecache = {} - fh = self.gitcmd("git diff-tree --root -m -r %s" % version) + fh = self.gitcmd("git diff-tree -z --root -m -r %s" % version) changes = [] seen = {} - for l in fh: - if "\t" not in l: - continue - m, f = l[:-1].split("\t") - if f in seen: + entry = None + for l in fh.read().split('\x00'): + if not entry: + if not l.startswith(':'): + continue + entry = l continue - seen[f] = 1 - m = m.split() - h = m[3] - p = (m[1] == "100755") - s = (m[1] == "120000") - self.modecache[(f, h)] = (p and "x") or (s and "l") or "" - changes.append((f, h)) + f = l + if f not in seen: + seen[f] = 1 + entry = entry.split() + h = entry[3] + p = (entry[1] == "100755") + s = (entry[1] == "120000") + self.modecache[(f, h)] = (p and "x") or (s and "l") or "" + changes.append((f, h)) + entry = None return (changes, {}) def getcommit(self, version): diff -r 3cbadcf28a4c -r 7e2e3aacc5dc mercurial/patch.py --- a/mercurial/patch.py Sun Oct 26 17:08:48 2008 +0800 +++ b/mercurial/patch.py Mon Oct 27 13:52:55 2008 +0100 @@ -31,9 +31,8 @@ raise util.Abort(_("cannot create %s: destination already exists") % dst) - targetdir = os.path.dirname(absdst) - if not os.path.isdir(targetdir): - os.makedirs(targetdir) + if not os.path.isdir(basedir): + os.makedirs(basedir) util.copyfile(abssrc, absdst) @@ -1061,7 +1060,7 @@ if line.startswith('patching file '): pf = util.parse_patch_output(line) printed_file = False - files.setdefault(pf, (None, None)) + files.setdefault(pf, None) elif line.find('with fuzz') >= 0: fuzz = True if not printed_file: diff -r 3cbadcf28a4c -r 7e2e3aacc5dc tests/test-import --- a/tests/test-import Sun Oct 26 17:08:48 2008 +0800 +++ b/tests/test-import Mon Oct 27 13:52:55 2008 +0100 @@ -20,6 +20,18 @@ hg --cwd b tip | grep someone rm -r b +echo % import exported patch with external patcher +cat > dummypatch.py < tip.patch +hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch +cat b/a +rm -r b + echo % import of plain diff should fail without message hg clone -r0 a b hg --cwd a diff -r0:1 > tip.patch diff -r 3cbadcf28a4c -r 7e2e3aacc5dc tests/test-import.out --- a/tests/test-import.out Sun Oct 26 17:08:48 2008 +0800 +++ b/tests/test-import.out Mon Oct 27 13:52:55 2008 +0100 @@ -13,6 +13,16 @@ summary: second change % committer should be same user: someone +% import exported patch with external patcher +requesting all changes +adding changesets +adding manifests +adding file changes +added 1 changesets with 2 changes to 2 files +updating working directory +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +applying ../tip.patch +line2 % import of plain diff should fail without message requesting all changes adding changesets diff -r 3cbadcf28a4c -r 7e2e3aacc5dc tests/test-init --- a/tests/test-init Sun Oct 26 17:08:48 2008 +0800 +++ b/tests/test-init Mon Oct 27 13:52:55 2008 +0100 @@ -44,10 +44,14 @@ echo this > local/foo hg ci --cwd local -A -m "init" -d "1000000 0" -echo "# creating repo with old format" +echo "# creating repo with format.usestore=false" hg --config format.usestore=false init old checknewrepo old +echo "# creating repo with format.usefncache=false" +hg --config format.usefncache=false init old2 +checknewrepo old2 + echo "#test failure" hg init local diff -r 3cbadcf28a4c -r 7e2e3aacc5dc tests/test-init.out --- a/tests/test-init.out Sun Oct 26 17:08:48 2008 +0800 +++ b/tests/test-init.out Mon Oct 27 13:52:55 2008 +0100 @@ -5,8 +5,13 @@ store fncache adding foo -# creating repo with old format +# creating repo with format.usestore=false revlogv1 +# creating repo with format.usefncache=false +store created +00changelog.i created +revlogv1 +store #test failure abort: repository local already exists! # init+push to remote2