##// END OF EJS Templates
largefiles: handle commit -A properly, after a --large commit (issue3542)...
Matt Harbison -
r17658:a02c1ffd stable
parent child Browse files
Show More
@@ -1018,11 +1018,12 def overridesummary(orig, ui, repo, *pat
1018 else:
1018 else:
1019 ui.status(_('largefiles: %d to upload\n') % len(toupload))
1019 ui.status(_('largefiles: %d to upload\n') % len(toupload))
1020
1020
1021 def overrideaddremove(orig, ui, repo, *pats, **opts):
1021 def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None,
1022 similarity=None):
1022 if not lfutil.islfilesrepo(repo):
1023 if not lfutil.islfilesrepo(repo):
1023 return orig(ui, repo, *pats, **opts)
1024 return orig(repo, pats, opts, dry_run, similarity)
1024 # Get the list of missing largefiles so we can remove them
1025 # Get the list of missing largefiles so we can remove them
1025 lfdirstate = lfutil.openlfdirstate(ui, repo)
1026 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1026 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False,
1027 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False,
1027 False, False)
1028 False, False)
1028 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
1029 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
@@ -1034,16 +1035,16 def overrideaddremove(orig, ui, repo, *p
1034 if missing:
1035 if missing:
1035 m = [repo.wjoin(f) for f in missing]
1036 m = [repo.wjoin(f) for f in missing]
1036 repo._isaddremove = True
1037 repo._isaddremove = True
1037 removelargefiles(ui, repo, *m, **opts)
1038 removelargefiles(repo.ui, repo, *m, **opts)
1038 repo._isaddremove = False
1039 repo._isaddremove = False
1039 # Call into the normal add code, and any files that *should* be added as
1040 # Call into the normal add code, and any files that *should* be added as
1040 # largefiles will be
1041 # largefiles will be
1041 addlargefiles(ui, repo, *pats, **opts)
1042 addlargefiles(repo.ui, repo, *pats, **opts)
1042 # Now that we've handled largefiles, hand off to the original addremove
1043 # Now that we've handled largefiles, hand off to the original addremove
1043 # function to take care of the rest. Make sure it doesn't do anything with
1044 # function to take care of the rest. Make sure it doesn't do anything with
1044 # largefiles by installing a matcher that will ignore them.
1045 # largefiles by installing a matcher that will ignore them.
1045 installnormalfilesmatchfn(repo[None].manifest())
1046 installnormalfilesmatchfn(repo[None].manifest())
1046 result = orig(ui, repo, *pats, **opts)
1047 result = orig(repo, pats, opts, dry_run, similarity)
1047 restorematchfn()
1048 restorematchfn()
1048 return result
1049 return result
1049
1050
@@ -9,7 +9,7
9 '''setup for largefiles extension: uisetup'''
9 '''setup for largefiles extension: uisetup'''
10
10
11 from mercurial import archival, cmdutil, commands, extensions, filemerge, hg, \
11 from mercurial import archival, cmdutil, commands, extensions, filemerge, hg, \
12 httppeer, localrepo, merge, sshpeer, sshserver, wireproto
12 httppeer, localrepo, merge, scmutil, sshpeer, sshserver, wireproto
13 from mercurial.i18n import _
13 from mercurial.i18n import _
14 from mercurial.hgweb import hgweb_mod, protocol, webcommands
14 from mercurial.hgweb import hgweb_mod, protocol, webcommands
15 from mercurial.subrepo import hgsubrepo
15 from mercurial.subrepo import hgsubrepo
@@ -30,8 +30,10 def uisetup(ui):
30 '(default: 10)'))]
30 '(default: 10)'))]
31 entry[1].extend(addopt)
31 entry[1].extend(addopt)
32
32
33 entry = extensions.wrapcommand(commands.table, 'addremove',
33 # The scmutil function is called both by the (trivial) addremove command,
34 overrides.overrideaddremove)
34 # and in the process of handling commit -A (issue3542)
35 entry = extensions.wrapfunction(scmutil, 'addremove',
36 overrides.scmutiladdremove)
35 entry = extensions.wrapcommand(commands.table, 'remove',
37 entry = extensions.wrapcommand(commands.table, 'remove',
36 overrides.overrideremove)
38 overrides.overrideremove)
37 entry = extensions.wrapcommand(commands.table, 'forget',
39 entry = extensions.wrapcommand(commands.table, 'forget',
@@ -543,6 +543,33 Test 3507 (both normal files and largefi
543 C sub2/large6
543 C sub2/large6
544 C sub2/large7
544 C sub2/large7
545
545
546 Test commit -A (issue 3542)
547 $ echo large8 > large8
548 $ hg add --large large8
549 $ hg ci -Am 'this used to add large8 as normal and commit both'
550 Invoking status precommit hook
551 A large8
552 Invoking status postcommit hook
553 C large8
554 C normal
555 C normal3
556 C sub/large4
557 C sub/normal4
558 C sub2/large6
559 C sub2/large7
560 $ rm large8
561 $ hg ci -Am 'this used to not notice the rm'
562 removing large8
563 Invoking status precommit hook
564 R large8
565 Invoking status postcommit hook
566 C normal
567 C normal3
568 C sub/large4
569 C sub/normal4
570 C sub2/large6
571 C sub2/large7
572
546 Test that a standin can't be added as a large file
573 Test that a standin can't be added as a large file
547
574
548 $ touch large
575 $ touch large
@@ -588,8 +615,19 Test that outgoing --large works (with r
588 date: Thu Jan 01 00:00:00 1970 +0000
615 date: Thu Jan 01 00:00:00 1970 +0000
589 summary: removed large
616 summary: removed large
590
617
618 changeset: 13:0a3e75774479
619 user: test
620 date: Thu Jan 01 00:00:00 1970 +0000
621 summary: this used to add large8 as normal and commit both
622
623 changeset: 14:84f3d378175c
624 user: test
625 date: Thu Jan 01 00:00:00 1970 +0000
626 summary: this used to not notice the rm
627
591 searching for changes
628 searching for changes
592 largefiles to upload:
629 largefiles to upload:
630 large8
593 large
631 large
594 foo
632 foo
595
633
General Comments 0
You need to be logged in to leave comments. Login now