Mercurial > hg
changeset 4782:37e11c768db9
merge with crew-stable
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Tue, 03 Jul 2007 03:14:18 -0300 |
parents | 38bf55d2e41f (current diff) e21a0e12ff10 (diff) |
children | 8b90d763ea90 |
files | |
diffstat | 7 files changed, 160 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Jul 02 22:34:38 2007 -0700 +++ b/mercurial/commands.py Tue Jul 03 03:14:18 2007 -0300 @@ -466,18 +466,17 @@ # return: hgsep def okaytocopy(abs, rel, exact): reasons = {'?': _('is not managed'), - 'a': _('has been marked for add'), 'r': _('has been marked for remove')} state = repo.dirstate.state(abs) reason = reasons.get(state) if reason: + if exact: + ui.warn(_('%s: not copying - file %s\n') % (rel, reason)) + else: if state == 'a': origsrc = repo.dirstate.copied(abs) if origsrc is not None: return origsrc - if exact: - ui.warn(_('%s: not copying - file %s\n') % (rel, reason)) - else: return abs # origsrc: hgsep @@ -532,8 +531,15 @@ if ui.verbose or not exact: ui.status(_('copying %s to %s\n') % (relsrc, reltarget)) targets[abstarget] = abssrc - if abstarget != origsrc and not opts.get('dry_run'): - repo.copy(origsrc, abstarget, wlock) + if abstarget != origsrc: + if repo.dirstate.state(origsrc) == 'a': + ui.warn(_("%s was marked for addition. " + "%s will not be committed as a copy.\n") + % (repo.pathto(origsrc, cwd), reltarget)) + if abstarget not in repo.dirstate and not opts.get('dry_run'): + repo.add([abstarget], wlock) + elif not opts.get('dry_run'): + repo.copy(origsrc, abstarget, wlock) copied.append((abssrc, relsrc, exact)) # pat: ossep
--- a/mercurial/hgweb/hgweb_mod.py Mon Jul 02 22:34:38 2007 -0700 +++ b/mercurial/hgweb/hgweb_mod.py Tue Jul 03 03:14:18 2007 -0300 @@ -404,7 +404,7 @@ parent=self.siblings(fctx.parents()), child=self.siblings(fctx.children()), rename=self.renamelink(fl, n), - permissions=fctx.manifest().execf(f)) + permissions=fctx.manifest().flags(f)) def fileannotate(self, fctx): f = fctx.path() @@ -440,7 +440,7 @@ rename=self.renamelink(fl, n), parent=self.siblings(fctx.parents()), child=self.siblings(fctx.children()), - permissions=fctx.manifest().execf(f)) + permissions=fctx.manifest().flags(f)) def manifest(self, ctx, path): mf = ctx.manifest() @@ -477,7 +477,7 @@ "parity": parity.next(), "basename": f, "size": ctx.filectx(full).size(), - "permissions": mf.execf(full)} + "permissions": mf.flags(full)} def dirlist(**map): fl = files.keys()
--- a/mercurial/templater.py Mon Jul 02 22:34:38 2007 -0700 +++ b/mercurial/templater.py Tue Jul 03 03:14:18 2007 -0300 @@ -245,6 +245,13 @@ yield '\n' return "".join(indenter()) +def permissions(flags): + if "l" in flags: + return "lrwxrwxrwx" + if "x" in flags: + return "-rwxr-xr-x" + return "-rw-r--r--" + common_filters = { "addbreaks": nl2br, "basename": os.path.basename, @@ -260,7 +267,7 @@ "hgdate": hgdate, "isodate": isodate, "obfuscate": obfuscate, - "permissions": lambda x: x and "-rwxr-xr-x" or "-rw-r--r--", + "permissions": permissions, "person": person, "rfc822date": lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S"), "short": lambda x: x[:12],
--- a/tests/test-copy2 Mon Jul 02 22:34:38 2007 -0700 +++ b/tests/test-copy2 Tue Jul 03 03:14:18 2007 -0300 @@ -2,16 +2,33 @@ hg init echo foo > foo +echo "# should fail - foo is not managed" +hg mv foo bar +hg st -A hg add foo +echo "# dry-run; print a warning that this is not a real copy; foo is added" +hg mv --dry-run foo bar +hg st -A +echo "# should print a warning that this is not a real copy; bar is added" +hg mv foo bar +hg st -A +echo "# should print a warning that this is not a real copy; foo is added" +hg cp bar foo +hg rm -f bar +rm bar +hg st -A hg commit -m1 -d"0 0" +echo "# dry-run; should show that foo is clean" +hg copy --dry-run foo bar +hg st -A echo "# should show copy" hg copy foo bar -hg debugstate|grep '^copy' +hg st -C echo "# shouldn't show copy" hg commit -m2 -d"0 0" -hg debugstate|grep '^copy' +hg st -C echo "# should match" hg debugindex .hg/store/data/foo.i @@ -26,7 +43,7 @@ hg copy -f foo bar echo "# should show copy" -hg debugstate|grep '^copy' +hg st -C hg commit -m3 -d"0 0" echo "# should show no parents for tip" @@ -36,7 +53,7 @@ hg debugrename bar echo "# should show no copies" -hg debugstate|grep '^copy' +hg st -C echo "# copy --after on an added file" cp bar baz
--- a/tests/test-copy2.out Mon Jul 02 22:34:38 2007 -0700 +++ b/tests/test-copy2.out Tue Jul 03 03:14:18 2007 -0300 @@ -1,5 +1,21 @@ +# should fail - foo is not managed +foo: not copying - file is not managed +abort: no files to copy +? foo +# dry-run; print a warning that this is not a real copy; foo is added +foo was marked for addition. bar will not be committed as a copy. +A foo +# should print a warning that this is not a real copy; bar is added +foo was marked for addition. bar will not be committed as a copy. +A bar +# should print a warning that this is not a real copy; foo is added +bar was marked for addition. foo will not be committed as a copy. +A foo +# dry-run; should show that foo is clean +C foo # should show copy -copy: foo -> bar +A bar + foo # shouldn't show copy # should match rev offset length base linkrev nodeid p1 p2 @@ -8,7 +24,8 @@ # should not be renamed bar not renamed # should show copy -copy: foo -> bar +M bar + foo # should show no parents for tip rev offset length base linkrev nodeid p1 p2 0 0 69 0 1 6ca237634e1f 000000000000 000000000000
--- a/tests/test-rename Mon Jul 02 22:34:38 2007 -0700 +++ b/tests/test-rename Tue Jul 03 03:14:18 2007 -0300 @@ -12,79 +12,79 @@ echo "# rename a single file" hg rename d1/d11/a1 d2/c -hg status +hg status -C hg update -C echo "# rename --after a single file" mv d1/d11/a1 d2/c hg rename --after d1/d11/a1 d2/c -hg status +hg status -C hg update -C echo "# move a single file to an existing directory" hg rename d1/d11/a1 d2 -hg status +hg status -C hg update -C echo "# move --after a single file to an existing directory" mv d1/d11/a1 d2 hg rename --after d1/d11/a1 d2 -hg status +hg status -C hg update -C echo "# rename a file using a relative path" (cd d1/d11; hg rename ../../d2/b e) -hg status +hg status -C hg update -C echo "# rename --after a file using a relative path" (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e) -hg status +hg status -C hg update -C echo "# rename directory d1 as d3" hg rename d1/ d3 -hg status +hg status -C hg update -C echo "# rename --after directory d1 as d3" mv d1 d3 hg rename --after d1 d3 -hg status +hg status -C hg update -C echo "# move a directory using a relative path" (cd d2; mkdir d3; hg rename ../d1/d11 d3) -hg status +hg status -C hg update -C echo "# move --after a directory using a relative path" (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3) -hg status +hg status -C hg update -C echo "# move directory d1/d11 to an existing directory d2 (removes empty d1)" hg rename d1/d11/ d2 -hg status +hg status -C hg update -C echo "# move directories d1 and d2 to a new directory d3" mkdir d3 hg rename d1 d2 d3 -hg status +hg status -C hg update -C echo "# move --after directories d1 and d2 to a new directory d3" mkdir d3 mv d1 d2 d3 hg rename --after d1 d2 d3 -hg status +hg status -C hg update -C echo "# move everything under directory d1 to existing directory d2, do not" echo "# overwrite existing files (d2/b)" hg rename d1/* d2 -hg status +hg status -C diff d1/b d2/b hg update -C @@ -95,117 +95,116 @@ echo "# move every file under d1 to d2/d21 (glob)" mkdir d2/d21 hg rename 'glob:d1/**' d2/d21 -hg status +hg status -C hg update -C echo "# move --after some files under d1 to d2/d21 (glob)" mkdir d2/d21 mv d1/a d1/d11/a1 d2/d21 hg rename --after 'glob:d1/**' d2/d21 -hg status +hg status -C hg update -C echo "# move every file under d1 starting with an 'a' to d2/d21 (regexp)" mkdir d2/d21 hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21 -hg status +hg status -C hg update -C echo "# attempt to overwrite an existing file" echo "ca" > d1/ca hg rename d1/ba d1/ca -hg status +hg status -C hg update -C echo "# forced overwrite of an existing file" echo "ca" > d1/ca hg rename --force d1/ba d1/ca -hg status +hg status -C hg update -C echo "# replace a symlink with a file" ln -s ba d1/ca hg rename --force d1/ba d1/ca -hg status +hg status -C hg update -C echo "# do not copy more than one source file to the same destination file" mkdir d3 hg rename d1/* d2/* d3 -hg status +hg status -C hg update -C echo "# move a whole subtree with \"hg rename .\"" mkdir d3 (cd d1; hg rename . ../d3) -hg status +hg status -C hg update -C echo "# move a whole subtree with \"hg rename --after .\"" mkdir d3 mv d1/* d3 (cd d1; hg rename --after . ../d3) -hg status +hg status -C hg update -C echo "# move the parent tree with \"hg rename ..\"" (cd d1/d11; hg rename .. ../../d3) -hg status +hg status -C hg update -C echo "# skip removed files" hg remove d1/b hg rename d1 d3 -hg status +hg status -C hg update -C echo "# transitive rename" hg rename d1/b d1/bb hg rename d1/bb d1/bc -hg status +hg status -C hg update -C echo "# transitive rename --after" hg rename d1/b d1/bb mv d1/bb d1/bc hg rename --after d1/bb d1/bc -hg status +hg status -C hg update -C echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)" hg rename d1/b d1/bb echo "some stuff added to d1/bb" >> d1/bb hg rename d1/bb d1/b -hg status -hg debugstate | grep copy +hg status -C hg update -C echo "# check illegal path components" hg rename d1/d11/a1 .hg/foo -hg status +hg status -C hg rename d1/d11/a1 ../foo -hg status +hg status -C mv d1/d11/a1 .hg/foo hg rename --after d1/d11/a1 .hg/foo -hg status +hg status -C hg update -C rm .hg/foo hg rename d1/d11/a1 .hg -hg status +hg status -C hg rename d1/d11/a1 .. -hg status +hg status -C mv d1/d11/a1 .hg hg rename --after d1/d11/a1 .hg -hg status +hg status -C hg update -C rm .hg/a1 (cd d1/d11; hg rename ../../d2/b ../../.hg/foo) -hg status +hg status -C (cd d1/d11; hg rename ../../d2/b ../../../foo) -hg status +hg status -C
--- a/tests/test-rename.out Mon Jul 02 22:34:38 2007 -0700 +++ b/tests/test-rename.out Tue Jul 03 03:14:18 2007 -0300 @@ -1,25 +1,31 @@ # rename a single file A d2/c + d1/d11/a1 R d1/d11/a1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # rename --after a single file A d2/c + d1/d11/a1 R d1/d11/a1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # move a single file to an existing directory A d2/a1 + d1/d11/a1 R d1/d11/a1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # move --after a single file to an existing directory A d2/a1 + d1/d11/a1 R d1/d11/a1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # rename a file using a relative path A d1/d11/e + d2/b R d2/b 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # rename --after a file using a relative path A d1/d11/e + d2/b R d2/b 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # rename directory d1 as d3 @@ -32,9 +38,13 @@ removing d1/ba removing d1/d11/a1 A d3/a + d1/a A d3/b + d1/b A d3/ba + d1/ba A d3/d11/a1 + d1/d11/a1 R d1/a R d1/b R d1/ba @@ -50,9 +60,13 @@ removing d1/ba removing d1/d11/a1 A d3/a + d1/a A d3/b + d1/b A d3/ba + d1/ba A d3/d11/a1 + d1/d11/a1 R d1/a R d1/b R d1/ba @@ -62,18 +76,21 @@ copying ../d1/d11/a1 to d3/d11/a1 removing ../d1/d11/a1 A d2/d3/d11/a1 + d1/d11/a1 R d1/d11/a1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # move --after a directory using a relative path copying ../d1/d11/a1 to d3/d11/a1 removing ../d1/d11/a1 A d2/d3/d11/a1 + d1/d11/a1 R d1/d11/a1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # move directory d1/d11 to an existing directory d2 (removes empty d1) copying d1/d11/a1 to d2/d11/a1 removing d1/d11/a1 A d2/d11/a1 + d1/d11/a1 R d1/d11/a1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # move directories d1 and d2 to a new directory d3 @@ -88,10 +105,15 @@ removing d1/d11/a1 removing d2/b A d3/d1/a + d1/a A d3/d1/b + d1/b A d3/d1/ba + d1/ba A d3/d1/d11/a1 + d1/d11/a1 A d3/d2/b + d2/b R d1/a R d1/b R d1/ba @@ -110,10 +132,15 @@ removing d1/d11/a1 removing d2/b A d3/d1/a + d1/a A d3/d1/b + d1/b A d3/d1/ba + d1/ba A d3/d1/d11/a1 + d1/d11/a1 A d3/d2/b + d2/b R d1/a R d1/b R d1/ba @@ -126,8 +153,11 @@ copying d1/d11/a1 to d2/d11/a1 removing d1/d11/a1 A d2/a + d1/a A d2/ba + d1/ba A d2/d11/a1 + d1/d11/a1 R d1/a R d1/ba R d1/d11/a1 @@ -149,9 +179,13 @@ removing d1/ba removing d1/d11/a1 A d2/d21/a + d1/a A d2/d21/a1 + d1/d11/a1 A d2/d21/b + d1/b A d2/d21/ba + d1/ba R d1/a R d1/b R d1/ba @@ -163,7 +197,9 @@ removing d1/a removing d1/d11/a1 A d2/d21/a + d1/a A d2/d21/a1 + d1/d11/a1 R d1/a R d1/d11/a1 2 files updated, 0 files merged, 2 files removed, 0 files unresolved @@ -173,7 +209,9 @@ removing d1/a removing d1/d11/a1 A d2/d21/a + d1/a A d2/d21/a1 + d1/d11/a1 R d1/a R d1/d11/a1 2 files updated, 0 files merged, 2 files removed, 0 files unresolved @@ -183,10 +221,12 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved # forced overwrite of an existing file A d1/ca + d1/ba R d1/ba 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # replace a symlink with a file A d1/ca + d1/ba R d1/ba 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # do not copy more than one source file to the same destination file @@ -194,9 +234,13 @@ d3/b: not overwriting - d2/b collides with d1/b removing d1/d11/a1 A d3/a + d1/a A d3/b + d1/b A d3/ba + d1/ba A d3/d11/a1 + d1/d11/a1 R d1/a R d1/b R d1/ba @@ -212,9 +256,13 @@ removing ba removing d11/a1 A d3/d1/a + d1/a A d3/d1/b + d1/b A d3/d1/ba + d1/ba A d3/d1/d11/a1 + d1/d11/a1 R d1/a R d1/b R d1/ba @@ -230,9 +278,13 @@ removing ba removing d11/a1 A d3/a + d1/a A d3/b + d1/b A d3/ba + d1/ba A d3/d11/a1 + d1/d11/a1 R d1/a R d1/b R d1/ba @@ -248,9 +300,13 @@ removing ../ba removing a1 A d3/a + d1/a A d3/b + d1/b A d3/ba + d1/ba A d3/d11/a1 + d1/d11/a1 R d1/a R d1/b R d1/ba @@ -264,8 +320,11 @@ removing d1/ba removing d1/d11/a1 A d3/a + d1/a A d3/ba + d1/ba A d3/d11/a1 + d1/d11/a1 R d1/a R d1/b R d1/ba @@ -273,10 +332,12 @@ 4 files updated, 0 files merged, 3 files removed, 0 files unresolved # transitive rename A d1/bc + d1/b R d1/b 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # transitive rename --after A d1/bc + d1/b R d1/b 1 files updated, 0 files merged, 1 files removed, 0 files unresolved # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)