Mercurial > hg
changeset 3028:ea734528ce04
merge with brendan
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 30 Aug 2006 19:58:54 +0200 |
parents | d9b8d28c0b94 (current diff) a4374f7331e4 (diff) |
children | eba7c78c80fe |
files | |
diffstat | 4 files changed, 64 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Fri Jul 28 13:46:19 2006 -0500 +++ b/hgext/mq.py Wed Aug 30 19:58:54 2006 +0200 @@ -919,13 +919,13 @@ return 1 wlock = repo.wlock() self.check_toppatch(repo) - (top, patch) = (self.applied[-1].rev, self.applied[-1].name) + (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(repo, top) - message, comments, user, date, patchfound = self.readheaders(patch) + message, comments, user, date, patchfound = self.readheaders(patchfn) - patchf = self.opener(patch, "w") + patchf = self.opener(patchfn, "w") msg = opts.get('msg', '').rstrip() if msg: if comments: @@ -995,8 +995,9 @@ r = list(util.unique(dd)) a = list(util.unique(aa)) filelist = filter(matchfn, util.unique(m + r + a)) - self.printdiff(repo, patchparent, files=filelist, - changes=(m, a, r, [], u), fp=patchf) + patch.diff(repo, patchparent, files=filelist, match=matchfn, + fp=patchf, changes=(m, a, r, [], u), + opts=self.diffopts()) patchf.close() changes = repo.changelog.read(tip) @@ -1019,7 +1020,7 @@ if not msg: if not message: - message = "patch queue: %s\n" % patch + message = "patch queue: %s\n" % patchfn else: message = "\n".join(message) else: @@ -1027,7 +1028,7 @@ self.strip(repo, top, update=False, backup='strip', wlock=wlock) n = repo.commit(filelist, message, changes[1], force=1, wlock=wlock) - self.applied[-1] = statusentry(revlog.hex(n), patch) + self.applied[-1] = statusentry(revlog.hex(n), patchfn) self.applied_dirty = 1 else: self.printdiff(repo, patchparent, fp=patchf)
--- a/mercurial/mdiff.py Fri Jul 28 13:46:19 2006 -0500 +++ b/mercurial/mdiff.py Wed Aug 30 19:58:54 2006 +0200 @@ -50,6 +50,9 @@ defaultopts = diffopts() def unidiff(a, ad, b, bd, fn, r=None, opts=defaultopts): + def datetag(date): + return opts.git and '\n' or '\t%s\n' % date + if not a and not b: return "" epoch = util.datestr((0, 0)) @@ -58,19 +61,19 @@ elif not a: b = splitnewlines(b) if a is None: - l1 = "--- %s\t%s\n" % ("/dev/null", epoch) + l1 = '--- /dev/null%s' % datetag(epoch) else: - l1 = "--- %s\t%s\n" % ("a/" + fn, ad) - l2 = "+++ %s\t%s\n" % ("b/" + fn, bd) + l1 = "--- %s%s" % ("a/" + fn, datetag(ad)) + l2 = "+++ %s%s" % ("b/" + fn, datetag(bd)) l3 = "@@ -0,0 +1,%d @@\n" % len(b) l = [l1, l2, l3] + ["+" + e for e in b] elif not b: a = splitnewlines(a) - l1 = "--- %s\t%s\n" % ("a/" + fn, ad) + l1 = "--- %s%s" % ("a/" + fn, datetag(ad)) if b is None: - l2 = "+++ %s\t%s\n" % ("/dev/null", epoch) + l2 = '+++ /dev/null%s' % datetag(epoch) else: - l2 = "+++ %s\t%s\n" % ("b/" + fn, bd) + l2 = "+++ %s%s" % ("b/" + fn, datetag(bd)) l3 = "@@ -1,%d +0,0 @@\n" % len(a) l = [l1, l2, l3] + ["-" + e for e in a] else: @@ -79,8 +82,8 @@ l = list(bunidiff(a, b, al, bl, "a/" + fn, "b/" + fn, opts=opts)) if not l: return "" # difflib uses a space, rather than a tab - l[0] = "%s\t%s\n" % (l[0][:-2], ad) - l[1] = "%s\t%s\n" % (l[1][:-2], bd) + l[0] = "%s%s" % (l[0][:-2], datetag(ad)) + l[1] = "%s%s" % (l[1][:-2], datetag(bd)) for ln in xrange(len(l)): if l[ln][-1] != '\n':
--- a/tests/test-mq Fri Jul 28 13:46:19 2006 -0500 +++ b/tests/test-mq Wed Aug 30 19:58:54 2006 +0200 @@ -126,6 +126,27 @@ hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/' hg unbundle .hg/strip-backup/* +echo '% cd b; hg qrefresh' +hg init refresh +cd refresh +echo a > a +hg ci -Ama -d'0 0' +hg qnew -mfoo foo +echo a >> a +hg qrefresh +mkdir b +cd b +echo f > f +hg add f +hg qrefresh +sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ + -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo +echo % hg qrefresh . +hg qrefresh . +sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ + -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo +hg status + cat >>$HGRCPATH <<EOF [diff] git = True
--- a/tests/test-mq.out Fri Jul 28 13:46:19 2006 -0500 +++ b/tests/test-mq.out Wed Aug 30 19:58:54 2006 +0200 @@ -127,6 +127,30 @@ adding file changes added 1 changesets with 1 changes to 1 files (run 'hg update' to get a working copy) +% cd b; hg qrefresh +adding a +foo + +diff -r cb9a9f314b8b a +--- a/a ++++ b/a +@@ -1,1 +1,2 @@ a + a ++a +diff -r cb9a9f314b8b b/f +--- /dev/null ++++ b/b/f +@@ -0,0 +1,1 @@ ++f +% hg qrefresh . +foo + +diff -r cb9a9f314b8b b/f +--- /dev/null ++++ b/b/f +@@ -0,0 +1,1 @@ ++f +M a new file diff --git a/new b/new