# HG changeset patch # User Alexis S. L. Carvalho # Date 1202502715 7200 # Node ID cfb4a51da7d592928d7fbaf43fc2ade9ff9ce57e # Parent a7178d4ed8ee6aacb5483bd3c8e3441c29ab4318# Parent 83633602e2c586104ba07451a19f9b532c9b660a Merge with crew-stable diff -r a7178d4ed8ee -r cfb4a51da7d5 hgext/mq.py --- a/hgext/mq.py Fri Feb 08 13:16:49 2008 -0200 +++ b/hgext/mq.py Fri Feb 08 18:31:55 2008 -0200 @@ -1554,6 +1554,8 @@ if r: if not os.path.exists(r.wjoin('.hgignore')): fp = r.wopener('.hgignore', 'w') + fp.write('^\\.hg\n') + fp.write('^\\.mq\n') fp.write('syntax: glob\n') fp.write('status\n') fp.write('guards\n') diff -r a7178d4ed8ee -r cfb4a51da7d5 mercurial/commands.py --- a/mercurial/commands.py Fri Feb 08 13:16:49 2008 -0200 +++ b/mercurial/commands.py Fri Feb 08 18:31:55 2008 -0200 @@ -225,6 +225,7 @@ revert_opts['date'] = None revert_opts['all'] = True revert_opts['rev'] = hex(parent) + revert_opts['no_backup'] = None revert(ui, repo, **revert_opts) commit_opts = opts.copy() commit_opts['addremove'] = False @@ -2196,7 +2197,6 @@ # but not other. names = {} - target_only = {} wlock = repo.wlock() try: @@ -2204,8 +2204,6 @@ for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, badmatch=mf.has_key): names[abs] = (rel, exact) - if src == 'b': - target_only[abs] = True # walk target manifest. @@ -2223,10 +2221,9 @@ if abs in names or src == 'b': continue names[abs] = (rel, exact) - target_only[abs] = True - - changes = repo.status(match=names.has_key)[:5] - modified, added, removed, deleted, unknown = map(dict.fromkeys, changes) + + changes = repo.status(match=names.has_key)[:4] + modified, added, removed, deleted = map(dict.fromkeys, changes) # if f is a rename, also revert the source cwd = repo.getcwd() @@ -2254,8 +2251,6 @@ (added, revert, forget, True, False), (removed, undelete, None, False, False), (deleted, revert, remove, False, False), - (unknown, add, None, True, False), - (target_only, add, None, False, False), ) entries = names.items() @@ -2282,10 +2277,14 @@ handle(hitlist, backuphit) elif misslist is not None: handle(misslist, backupmiss) - else: - if exact: ui.warn(_('file not managed: %s\n') % rel) break else: + if abs not in repo.dirstate: + if mfentry: + handle(add, True) + elif exact: + ui.warn(_('file not managed: %s\n') % rel) + continue # file has not changed in dirstate if node == parent: if exact: ui.warn(_('no changes needed to %s\n') % rel) @@ -2298,7 +2297,8 @@ if mfentry: # if version of file is same in parent and target # manifests, do nothing - if pmf[abs] != mfentry: + if (pmf[abs] != mfentry or + pmf.flags(abs) != mf.flags(abs)): handle(revert, False) else: handle(remove, False) diff -r a7178d4ed8ee -r cfb4a51da7d5 mercurial/dirstate.py --- a/mercurial/dirstate.py Fri Feb 08 13:16:49 2008 -0200 +++ b/mercurial/dirstate.py Fri Feb 08 18:31:55 2008 -0200 @@ -369,6 +369,14 @@ % (self.pathto(f), kind)) return False + def _dirignore(self, f): + if self._ignore(f): + return True + for c in strutil.findall(f, '/'): + if self._ignore(f[:c]): + return True + return False + def walk(self, files=None, match=util.always, badmatch=None): # filter out the stat for src, f, st in self.statwalk(files, match, badmatch=badmatch): @@ -404,9 +412,11 @@ return match(file_) ignore = self._ignore + dirignore = self._dirignore if ignored: imatch = match ignore = util.never + dirignore = util.never # self._root may end with a path separator when self._root == '/' common_prefix_len = len(self._root) @@ -492,8 +502,9 @@ yield 'b', ff, None continue if s_isdir(st.st_mode): - for f, src, st in findfiles(f): - yield src, f, st + if not dirignore(nf): + for f, src, st in findfiles(f): + yield src, f, st else: if nf in known: continue @@ -519,6 +530,7 @@ lookup, modified, added, unknown, ignored = [], [], [], [], [] removed, deleted, clean = [], [], [] + files = files or [] _join = self._join lstat = os.lstat cmap = self._copymap @@ -536,8 +548,9 @@ if fn in dmap: type_, mode, size, time, foo = dmap[fn] else: - if list_ignored and self._ignore(fn): - iadd(fn) + if (list_ignored or fn in files) and self._dirignore(fn): + if list_ignored: + iadd(fn) else: uadd(fn) continue diff -r a7178d4ed8ee -r cfb4a51da7d5 templates/header.tmpl --- a/templates/header.tmpl Fri Feb 08 13:16:49 2008 -0200 +++ b/templates/header.tmpl Fri Feb 08 18:31:55 2008 -0200 @@ -1,6 +1,6 @@ - + diff -r a7178d4ed8ee -r cfb4a51da7d5 templates/old/header.tmpl --- a/templates/old/header.tmpl Fri Feb 08 13:16:49 2008 -0200 +++ b/templates/old/header.tmpl Fri Feb 08 18:31:55 2008 -0200 @@ -1,6 +1,6 @@ - + diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-hgweb-commands.out Binary file tests/test-hgweb-commands.out has changed diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-hgweb.out --- a/tests/test-hgweb.out Fri Feb 08 13:16:49 2008 -0200 +++ b/tests/test-hgweb.out Fri Feb 08 18:31:55 2008 -0200 @@ -24,7 +24,7 @@ - + diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-mq.out --- a/tests/test-mq.out Fri Feb 08 13:16:49 2008 -0200 +++ b/tests/test-mq.out Fri Feb 08 18:31:55 2008 -0200 @@ -70,6 +70,8 @@ A test.patch % qinit; qinit -c .hgignore: +^\.hg +^\.mq syntax: glob status guards diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-revert --- a/tests/test-revert Fri Feb 08 13:16:49 2008 -0200 +++ b/tests/test-revert Fri Feb 08 18:31:55 2008 -0200 @@ -1,6 +1,7 @@ #!/bin/sh -hg init +hg init repo +cd repo echo 123 > a echo 123 > c echo 123 > e @@ -40,19 +41,26 @@ rm q echo %% should say file not found hg revert notfound +touch d +hg add d hg rm a hg commit -m "second" -d "1000000 0" echo z > z hg add z hg st -echo %% should add a, forget z +echo %% should add a, remove d, forget z hg revert --all -r0 -echo %% should forget a +echo %% should forget a, undelete d hg revert --all -rtip rm a *.orig echo %% should silently add a hg revert -r0 a hg st a +hg rm d +hg st d +echo %% should silently keep d removed +hg revert -r0 d +hg st d hg update -C chmod +x c @@ -68,6 +76,8 @@ echo %% should print executable test -x c && echo executable +cd .. + echo %% issue 241 hg init a cd a @@ -100,3 +110,33 @@ hg revert newa hg st a newa +cd .. + +hg init ignored +cd ignored +echo '^ignored$' > .hgignore +echo '^ignoreddir$' >> .hgignore +echo '^removed$' >> .hgignore + +mkdir ignoreddir +touch ignoreddir/file +touch ignoreddir/removed +touch ignored +touch removed +echo '%% 4 ignored files (we will add/commit everything)' +hg st -A -X .hgignore +hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed + +echo >> ignored +echo >> ignoreddir/file +hg rm removed ignoreddir/removed +echo '%% should revert ignored* and undelete *removed' +hg revert -a --no-backup +hg st -mardi + +hg up -qC +echo >> ignored +hg rm removed +echo %% should silently revert the named files +hg revert --no-backup ignored removed +hg st -mardi diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-revert-flags --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-revert-flags Fri Feb 08 18:31:55 2008 -0200 @@ -0,0 +1,17 @@ +#!/bin/sh + +"$TESTDIR/hghave" execbit || exit 80 + +hg init repo +cd repo +echo foo > foo +chmod 644 foo +hg ci -qAm '644' + +chmod 755 foo +hg ci -qAm '755' + +echo '% reverting to rev 0' +hg revert -a -r 0 +hg st +hg diff --git diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-revert-flags.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-revert-flags.out Fri Feb 08 18:31:55 2008 -0200 @@ -0,0 +1,6 @@ +% reverting to rev 0 +reverting foo +M foo +diff --git a/foo b/foo +old mode 100755 +new mode 100644 diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-revert.out --- a/tests/test-revert.out Fri Feb 08 13:16:49 2008 -0200 +++ b/tests/test-revert.out Fri Feb 08 18:31:55 2008 -0200 @@ -37,14 +37,19 @@ A z ? b ? e.orig -%% should add a, forget z +%% should add a, remove d, forget z adding a +removing d forgetting z -%% should forget a +%% should forget a, undelete d forgetting a +undeleting d %% should silently add a A a -0 files updated, 0 files merged, 1 files removed, 0 files unresolved +R d +%% should silently keep d removed +R d +1 files updated, 0 files merged, 1 files removed, 0 files unresolved reverting c %% should print non-executable non-executable @@ -65,3 +70,14 @@ reverting b/b % reverting a rename target should revert the source ? newa +%% 4 ignored files (we will add/commit everything) +I ignored +I ignoreddir/file +I ignoreddir/removed +I removed +%% should revert ignored* and undelete *removed +reverting ignored +reverting ignoreddir/file +undeleting ignoreddir/removed +undeleting removed +%% should silently revert the named files diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-status --- a/tests/test-status Fri Feb 08 13:16:49 2008 -0200 +++ b/tests/test-status Fri Feb 08 18:31:55 2008 -0200 @@ -21,7 +21,7 @@ hg init repo2 cd repo2 touch modified removed deleted ignored -echo "ignored" > .hgignore +echo "^ignored$" > .hgignore hg ci -A -m 'initial checkin' -d "1000000 0" sleep 1 # make sure mtime is changed touch modified added unknown ignored @@ -37,3 +37,10 @@ hg status -C echo "hg status -A:" hg status -A +echo "^ignoreddir$" > .hgignore +mkdir ignoreddir +touch ignoreddir/file +echo "hg status ignoreddir/file:" +hg status ignoreddir/file +echo "hg status -i ignoreddir/file:" +hg status -i ignoreddir/file diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-status.out --- a/tests/test-status.out Fri Feb 08 13:16:49 2008 -0200 +++ b/tests/test-status.out Fri Feb 08 18:31:55 2008 -0200 @@ -99,7 +99,6 @@ A added R removed ! deleted -? ignored ? unknown hg status -C: A added @@ -118,3 +117,6 @@ I ignored C .hgignore C modified +hg status ignoreddir/file: +hg status -i ignoreddir/file: +I ignoreddir/file diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-walk --- a/tests/test-walk Fri Feb 08 13:16:49 2008 -0200 +++ b/tests/test-walk Fri Feb 08 18:31:55 2008 -0200 @@ -93,6 +93,13 @@ debugwalk fenugreek touch new debugwalk new + +mkdir ignored +touch ignored/file +echo '^ignored$' > .hgignore +debugwalk ignored +debugwalk ignored/file + chdir .. debugwalk -R t t/mammals/skunk mkdir t2 diff -r a7178d4ed8ee -r cfb4a51da7d5 tests/test-walk.out --- a/tests/test-walk.out Fri Feb 08 13:16:49 2008 -0200 +++ b/tests/test-walk.out Fri Feb 08 18:31:55 2008 -0200 @@ -283,6 +283,11 @@ hg debugwalk new f new new exact +hg debugwalk ignored + +hg debugwalk ignored/file +f ignored/file ignored/file exact + cd .. hg debugwalk -R t t/mammals/skunk