changeset 15431:c41055249725

merge with main
author Martin Geisler <mg@aragost.com>
date Fri, 04 Nov 2011 10:32:13 +0100
parents dc9d0189f60e (current diff) afc02adf4ded (diff)
children 2ddae301d0a2
files
diffstat 10 files changed, 155 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Thu Nov 03 14:40:58 2011 +0100
+++ b/hgext/largefiles/lfutil.py	Fri Nov 04 10:32:13 2011 +0100
@@ -110,7 +110,9 @@
         repo.ui.note(_('Found %s in store\n') % hash)
     elif inusercache(repo.ui, hash):
         repo.ui.note(_('Found %s in system cache\n') % hash)
-        link(usercachepath(repo.ui, hash), storepath(repo, hash))
+        path = storepath(repo, hash)
+        util.makedirs(os.path.dirname(path))
+        link(usercachepath(repo.ui, hash), path)
     else:
         return None
     return storepath(repo, hash)
--- a/mercurial/cmdutil.py	Thu Nov 03 14:40:58 2011 +0100
+++ b/mercurial/cmdutil.py	Fri Nov 04 10:32:13 2011 +0100
@@ -1165,15 +1165,19 @@
             if ui.verbose or not exact:
                 ui.status(_('adding %s\n') % match.rel(join(f)))
 
-    if listsubrepos:
-        for subpath in wctx.substate:
-            sub = wctx.sub(subpath)
-            try:
-                submatch = matchmod.narrowmatcher(subpath, match)
+    for subpath in wctx.substate:
+        sub = wctx.sub(subpath)
+        try:
+            submatch = matchmod.narrowmatcher(subpath, match)
+            if listsubrepos:
                 bad.extend(sub.add(ui, submatch, dryrun, prefix))
-            except error.LookupError:
-                ui.status(_("skipping missing subrepository: %s\n")
-                               % join(subpath))
+            else:
+                for f in sub.walk(submatch):
+                    if submatch.exact(f):
+                        bad.extend(sub.add(ui, submatch, dryrun, prefix))
+        except error.LookupError:
+            ui.status(_("skipping missing subrepository: %s\n")
+                           % join(subpath))
 
     if not dryrun:
         rejected = wctx.add(names, prefix)
--- a/mercurial/commands.py	Thu Nov 03 14:40:58 2011 +0100
+++ b/mercurial/commands.py	Fri Nov 04 10:32:13 2011 +0100
@@ -3705,14 +3705,14 @@
     [('f', 'follow', None,
      _('follow changeset history, or file history across copies and renames')),
     ('', 'follow-first', None,
-     _('only follow the first parent of merge changesets')),
+     _('only follow the first parent of merge changesets (DEPRECATED)')),
     ('d', 'date', '', _('show revisions matching date spec'), _('DATE')),
     ('C', 'copies', None, _('show copied files')),
     ('k', 'keyword', [],
      _('do case-insensitive search for a given text'), _('TEXT')),
     ('r', 'rev', [], _('show the specified revision or range'), _('REV')),
     ('', 'removed', None, _('include revisions where files were removed')),
-    ('m', 'only-merges', None, _('show only merges')),
+    ('m', 'only-merges', None, _('show only merges (DEPRECATED)')),
     ('u', 'user', [], _('revisions committed by user'), _('USER')),
     ('', 'only-branch', [],
      _('show only changesets within the given named branch (DEPRECATED)'),
--- a/mercurial/hbisect.py	Thu Nov 03 14:40:58 2011 +0100
+++ b/mercurial/hbisect.py	Fri Nov 04 10:32:13 2011 +0100
@@ -220,7 +220,7 @@
         else:
             raise error.ParseError(_('invalid bisect state'))
 
-def label(repo, node, short=False):
+def label(repo, node):
     rev = repo.changelog.rev(node)
 
     # Try explicit sets
--- a/mercurial/help/subrepos.txt	Thu Nov 03 14:40:58 2011 +0100
+++ b/mercurial/help/subrepos.txt	Fri Nov 04 10:32:13 2011 +0100
@@ -73,7 +73,9 @@
 -----------------------------------
 
 :add: add does not recurse in subrepos unless -S/--subrepos is
-    specified. Subversion subrepositories are currently silently
+    specified.  However, if you specify the full path of a file in a
+    subrepo, it will be added even without -S/--subrepos specified.
+    Subversion subrepositories are currently silently
     ignored.
 
 :archive: archive does not recurse in subrepositories unless
--- a/mercurial/ignore.py	Thu Nov 03 14:40:58 2011 +0100
+++ b/mercurial/ignore.py	Fri Nov 04 10:32:13 2011 +0100
@@ -78,6 +78,7 @@
             pats[f] = []
             fp = open(f)
             pats[f], warnings = ignorepats(fp)
+            fp.close()
             for warning in warnings:
                 warn("%s: %s\n" % (f, warning))
         except IOError, inst:
--- a/mercurial/revlog.py	Thu Nov 03 14:40:58 2011 +0100
+++ b/mercurial/revlog.py	Fri Nov 04 10:32:13 2011 +0100
@@ -800,6 +800,7 @@
         readahead = max(65536, length)
         df.seek(offset)
         d = df.read(readahead)
+        df.close()
         self._addchunk(offset, d)
         if readahead > length:
             return d[:length]
--- a/mercurial/subrepo.py	Thu Nov 03 14:40:58 2011 +0100
+++ b/mercurial/subrepo.py	Fri Nov 04 10:32:13 2011 +0100
@@ -353,6 +353,12 @@
                         unit=_('files'), total=total)
         ui.progress(_('archiving (%s)') % relpath, None)
 
+    def walk(self, match):
+        '''
+        walk recursively through the directory tree, finding all files
+        matched by the match function
+        '''
+        pass
 
 class hgsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
@@ -543,6 +549,9 @@
         ctx = self._repo[rev]
         return ctx.flags(name)
 
+    def walk(self, match):
+        ctx = self._repo[None]
+        return ctx.walk(match)
 
 class svnsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
--- a/mercurial/ui.py	Thu Nov 03 14:40:58 2011 +0100
+++ b/mercurial/ui.py	Fri Nov 04 10:32:13 2011 +0100
@@ -79,6 +79,7 @@
 
         try:
             cfg.read(filename, fp, sections=sections, remap=remap)
+            fp.close()
         except error.ConfigError, inst:
             if trusted:
                 raise
--- a/tests/test-subrepo.t	Thu Nov 03 14:40:58 2011 +0100
+++ b/tests/test-subrepo.t	Fri Nov 04 10:32:13 2011 +0100
@@ -883,3 +883,125 @@
   rm2
   
   
+Test behavior of add for explicit path in subrepo:
+  $ cd ..
+  $ hg init addtests
+  $ cd addtests
+  $ echo s = s > .hgsub
+  $ hg add .hgsub
+  $ hg init s
+  $ hg ci -m0
+  committing subrepository s
+Adding with an explicit path in a subrepo adds the file
+  $ echo c1 > f1
+  $ echo c2 > s/f2
+  $ hg st -S
+  ? f1
+  ? s/f2
+  $ hg add s/f2
+  $ hg st -S
+  A s/f2
+  ? f1
+  $ hg ci -R s -m0
+  $ hg ci -Am1
+  adding f1
+  committing subrepository s
+Adding with an explicit path in a subrepo with -S has the same behavior
+  $ echo c3 > f3
+  $ echo c4 > s/f4
+  $ hg st -S
+  ? f3
+  ? s/f4
+  $ hg add -S s/f4
+  $ hg st -S
+  A s/f4
+  ? f3
+  $ hg ci -R s -m1
+  $ hg ci -Ama2
+  adding f3
+  committing subrepository s
+Adding without a path or pattern silently ignores subrepos
+  $ echo c5 > f5
+  $ echo c6 > s/f6
+  $ echo c7 > s/f7
+  $ hg st -S
+  ? f5
+  ? s/f6
+  ? s/f7
+  $ hg add
+  adding f5
+  $ hg st -S
+  A f5
+  ? s/f6
+  ? s/f7
+  $ hg ci -R s -Am2
+  adding f6
+  adding f7
+  $ hg ci -m3
+  committing subrepository s
+Adding without a path or pattern with -S also adds files in subrepos
+  $ echo c8 > f8
+  $ echo c9 > s/f9
+  $ echo c10 > s/f10
+  $ hg st -S
+  ? f8
+  ? s/f10
+  ? s/f9
+  $ hg add -S
+  adding f8
+  adding s/f10
+  adding s/f9
+  $ hg st -S
+  A f8
+  A s/f10
+  A s/f9
+  $ hg ci -R s -m3
+  $ hg ci -m4
+  committing subrepository s
+Adding with a pattern silently ignores subrepos
+  $ echo c11 > fm11
+  $ echo c12 > fn12
+  $ echo c13 > s/fm13
+  $ echo c14 > s/fn14
+  $ hg st -S
+  ? fm11
+  ? fn12
+  ? s/fm13
+  ? s/fn14
+  $ hg add 'glob:**fm*'
+  adding fm11
+  $ hg st -S
+  A fm11
+  ? fn12
+  ? s/fm13
+  ? s/fn14
+  $ hg ci -R s -Am4
+  adding fm13
+  adding fn14
+  $ hg ci -Am5
+  adding fn12
+  committing subrepository s
+Adding with a pattern with -S also adds matches in subrepos
+  $ echo c15 > fm15
+  $ echo c16 > fn16
+  $ echo c17 > s/fm17
+  $ echo c18 > s/fn18
+  $ hg st -S
+  ? fm15
+  ? fn16
+  ? s/fm17
+  ? s/fn18
+  $ hg add -S 'glob:**fm*'
+  adding fm15
+  adding s/fm17
+  $ hg st -S
+  A fm15
+  A s/fm17
+  ? fn16
+  ? s/fn18
+  $ hg ci -R s -Am5
+  adding fn18
+  $ hg ci -Am6
+  adding fn16
+  committing subrepository s
+  $ cd ..