merge with stable
authorMatt Mackall <mpm@selenic.com>
Thu, 27 Sep 2012 15:51:14 -0500
changeset 17661 67deea9c1c42
parent 17654 1dc37491e9fb (current diff)
parent 17660 f36f11f2bfce (diff)
child 17662 4f2390e3f4b0
merge with stable
hgext/largefiles/lfutil.py
hgext/largefiles/overrides.py
i18n/ru.po
tests/test-largefiles.t
--- a/hgext/largefiles/lfutil.py	Fri Aug 31 02:06:29 2012 +0900
+++ b/hgext/largefiles/lfutil.py	Thu Sep 27 15:51:14 2012 -0500
@@ -141,7 +141,7 @@
     def normallookup(self, f):
         return super(largefilesdirstate, self).normallookup(unixpath(f))
 
-def openlfdirstate(ui, repo):
+def openlfdirstate(ui, repo, create=True):
     '''
     Return a dirstate object that tracks largefiles: i.e. its root is
     the repo root, but it is saved in .hg/largefiles/dirstate.
@@ -154,7 +154,7 @@
     # If the largefiles dirstate does not exist, populate and create
     # it. This ensures that we create it on the first meaningful
     # largefiles operation in a new clone.
-    if not os.path.exists(os.path.join(admin, 'dirstate')):
+    if create and not os.path.exists(os.path.join(admin, 'dirstate')):
         util.makedirs(admin)
         matcher = getstandinmatcher(repo)
         for standin in dirstatewalk(repo.dirstate, matcher):
@@ -435,8 +435,11 @@
     return util.pconvert(os.path.normpath(path))
 
 def islfilesrepo(repo):
-    return ('largefiles' in repo.requirements and
-            util.any(shortname + '/' in f[0] for f in repo.store.datafiles()))
+    if ('largefiles' in repo.requirements and
+            util.any(shortname + '/' in f[0] for f in repo.store.datafiles())):
+        return True
+
+    return util.any(openlfdirstate(repo.ui, repo, False))
 
 class storeprotonotcapable(Exception):
     def __init__(self, storetypes):
--- a/hgext/largefiles/overrides.py	Fri Aug 31 02:06:29 2012 +0900
+++ b/hgext/largefiles/overrides.py	Thu Sep 27 15:51:14 2012 -0500
@@ -1018,11 +1018,12 @@
         else:
             ui.status(_('largefiles: %d to upload\n') % len(toupload))
 
-def overrideaddremove(orig, ui, repo, *pats, **opts):
+def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None,
+                     similarity=None):
     if not lfutil.islfilesrepo(repo):
-        return orig(ui, repo, *pats, **opts)
+        return orig(repo, pats, opts, dry_run, similarity)
     # Get the list of missing largefiles so we can remove them
-    lfdirstate = lfutil.openlfdirstate(ui, repo)
+    lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
     s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False,
         False, False)
     (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
@@ -1034,16 +1035,16 @@
     if missing:
         m = [repo.wjoin(f) for f in missing]
         repo._isaddremove = True
-        removelargefiles(ui, repo, *m, **opts)
+        removelargefiles(repo.ui, repo, *m, **opts)
         repo._isaddremove = False
     # Call into the normal add code, and any files that *should* be added as
     # largefiles will be
-    addlargefiles(ui, repo, *pats, **opts)
+    addlargefiles(repo.ui, repo, *pats, **opts)
     # Now that we've handled largefiles, hand off to the original addremove
     # function to take care of the rest.  Make sure it doesn't do anything with
     # largefiles by installing a matcher that will ignore them.
     installnormalfilesmatchfn(repo[None].manifest())
-    result = orig(ui, repo, *pats, **opts)
+    result = orig(repo, pats, opts, dry_run, similarity)
     restorematchfn()
     return result
 
--- a/hgext/largefiles/uisetup.py	Fri Aug 31 02:06:29 2012 +0900
+++ b/hgext/largefiles/uisetup.py	Thu Sep 27 15:51:14 2012 -0500
@@ -9,7 +9,7 @@
 '''setup for largefiles extension: uisetup'''
 
 from mercurial import archival, cmdutil, commands, extensions, filemerge, hg, \
-    httppeer, localrepo, merge, sshpeer, sshserver, wireproto
+    httppeer, localrepo, merge, scmutil, sshpeer, sshserver, wireproto
 from mercurial.i18n import _
 from mercurial.hgweb import hgweb_mod, protocol, webcommands
 from mercurial.subrepo import hgsubrepo
@@ -30,8 +30,10 @@
                                    '(default: 10)'))]
     entry[1].extend(addopt)
 
-    entry = extensions.wrapcommand(commands.table, 'addremove',
-            overrides.overrideaddremove)
+    # The scmutil function is called both by the (trivial) addremove command,
+    # and in the process of handling commit -A (issue3542)
+    entry = extensions.wrapfunction(scmutil, 'addremove',
+                                    overrides.scmutiladdremove)
     entry = extensions.wrapcommand(commands.table, 'remove',
                                    overrides.overrideremove)
     entry = extensions.wrapcommand(commands.table, 'forget',
--- a/i18n/ru.po	Fri Aug 31 02:06:29 2012 +0900
+++ b/i18n/ru.po	Thu Sep 27 15:51:14 2012 -0500
@@ -173,7 +173,7 @@
 msgstr ""
 "Project-Id-Version: Mercurial\n"
 "Report-Msgid-Bugs-To: <mercurial-devel@selenic.com>\n"
-"POT-Creation-Date: 2012-08-13 16:01+0400\n"
+"POT-Creation-Date: 2012-09-25 15:43+0400\n"
 "PO-Revision-Date: 2011-05-12 23:48+0400\n"
 "Last-Translator: Alexander Sauta <demosito@gmail.com>\n"
 "Language-Team: Russian\n"
@@ -11501,6 +11501,12 @@
 msgstr ""
 "запускает протокол обнаружения набора изменения в изолированном окружении"
 
+msgid "apply the filespec on this revision"
+msgstr "применить filespec к этой ревизии"
+
+msgid "[-r REV] FILESPEC"
+msgstr "[-r РЕВИЗИЯ] FILESPEC"
+
 msgid "parse and apply a fileset specification"
 msgstr "разобрать и применить спецификацию набора файлов (fileset)"
 
@@ -11565,6 +11571,10 @@
 msgstr " (проверьте правильность установки локали)\n"
 
 #, python-format
+msgid "checking Python lib (%s)...\n"
+msgstr "проверка библиотеки Python (%s)...\n"
+
+#, python-format
 msgid "checking installed modules (%s)...\n"
 msgstr "проверка установленных модулей (%s)...\n"
 
@@ -14546,7 +14556,7 @@
 "    changeset (see :hg:`help parents`)."
 msgstr ""
 "    Update делает заданный набор изменений родительской ревизией рабочего\n"
-"    каталога (см. :hg:`help parents`)."
+"    набор изменений (см. :hg:`help parents`)."
 
 msgid ""
 "    If the changeset is not a descendant or ancestor of the working\n"
@@ -15336,10 +15346,15 @@
 "``grep(regex)``\n"
 "    Файл, содержащий заданное регулярное выражение."
 
+#. i18n: "grep" is a keyword
 msgid "grep requires a pattern"
 msgstr "grep требует шаблон"
 
 #, python-format
+msgid "invalid match pattern: %s"
+msgstr "неверный шаблон поиска: %s"
+
+#, python-format
 msgid "couldn't parse size: %s"
 msgstr "неверно задан размер: %s"
 
@@ -21280,18 +21295,18 @@
 "2. Nested repository references. They are defined in ``.hgsub``, which\n"
 "   should be placed in the root of working directory, and\n"
 "   tell where the subrepository checkouts come from. Mercurial\n"
-"   subrepositories are referenced like:"
+"   subrepositories are referenced like::"
 msgstr ""
 "2. Ссылки на вложенные хранилища. Они определяются в файле ``.hgsub``,\n"
 "   который должен находиться в корне рабочего каталога, и описывают,\n"
 "   откуда были извлечены копии подхранилищ.\n"
-"   Подхранилища имеют такие пути:"
+"   Подхранилища Mercirial имеют такие пути::"
 
 msgid "     path/to/nested = https://example.com/nested/repo/path"
 msgstr "     path/to/nested = https://example.com/nested/repo/path"
 
-msgid "   Git and Subversion subrepos are also supported:"
-msgstr "   Поддерживаются также подхранилища Git и Subversion:"
+msgid "   Git and Subversion subrepos are also supported::"
+msgstr "   Поддерживаются также подхранилища Git и Subversion::"
 
 msgid ""
 "     path/to/nested = [git]git://example.com/nested/repo/path\n"
@@ -23039,10 +23054,6 @@
 msgid "grep requires a string"
 msgstr "grep требует строку"
 
-#, python-format
-msgid "invalid match pattern: %s"
-msgstr "неверный шаблон поиска: %s"
-
 #. i18n: "_matchfiles" is a keyword
 msgid "_matchfiles requires at least one argument"
 msgstr "_matchfiles требует хотя бы один аргумент"
@@ -24378,7 +24389,7 @@
 msgstr "ожидается ответ"
 
 msgid "unrecognized response\n"
-msgstr "не распознанный ответ\n"
+msgstr "нераспознанный ответ\n"
 
 msgid "password: "
 msgstr "пароль: "
--- a/tests/test-largefiles.t	Fri Aug 31 02:06:29 2012 +0900
+++ b/tests/test-largefiles.t	Thu Sep 27 15:51:14 2012 -0500
@@ -543,6 +543,33 @@
   C sub2/large6
   C sub2/large7
 
+Test commit -A (issue 3542)
+  $ echo large8 > large8
+  $ hg add --large large8
+  $ hg ci -Am 'this used to add large8 as normal and commit both'
+  Invoking status precommit hook
+  A large8
+  Invoking status postcommit hook
+  C large8
+  C normal
+  C normal3
+  C sub/large4
+  C sub/normal4
+  C sub2/large6
+  C sub2/large7
+  $ rm large8
+  $ hg ci -Am 'this used to not notice the rm'
+  removing large8
+  Invoking status precommit hook
+  R large8
+  Invoking status postcommit hook
+  C normal
+  C normal3
+  C sub/large4
+  C sub/normal4
+  C sub2/large6
+  C sub2/large7
+
 Test that a standin can't be added as a large file
 
   $ touch large
@@ -588,8 +615,19 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     removed large
   
+  changeset:   13:0a3e75774479
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     this used to add large8 as normal and commit both
+  
+  changeset:   14:84f3d378175c
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     this used to not notice the rm
+  
   searching for changes
   largefiles to upload:
+  large8
   large
   foo
   
@@ -1545,3 +1583,40 @@
   lf_subrepo_archive/subrepo/normal.txt
 
   $ cd ..
+
+Test that addremove picks up largefiles prior to the initial commit (issue3541)
+
+  $ hg init addrm2
+  $ cd addrm2
+  $ touch large.dat
+  $ touch large2.dat
+  $ touch normal
+  $ hg add --large large.dat
+  $ hg addremove -v
+  adding large2.dat as a largefile
+  adding normal
+
+Test that forgetting all largefiles reverts to islfilesrepo() == False
+(addremove will add *.dat as normal files now)
+  $ hg forget large.dat
+  $ hg forget large2.dat
+  $ hg addremove -v
+  adding large.dat
+  adding large2.dat
+
+Test commit's addremove option prior to the first commit
+  $ hg forget large.dat
+  $ hg forget large2.dat
+  $ hg add --large large.dat
+  $ hg ci -Am "commit"
+  adding large2.dat as a largefile
+  Invoking status precommit hook
+  A large.dat
+  A large2.dat
+  A normal
+  $ find .hglf/ | sort
+  .hglf/
+  .hglf/large.dat
+  .hglf/large2.dat
+
+  $ cd ..