Mercurial > hg-stable
annotate tests/test-bugzilla.t @ 35121:66c5a8cf2868
lfs: import the Facebook git-lfs client extension
The purpose of this is the same as the built-in largefiles extension- to handle
huge files outside of the normal storage system, generally to keep the amount of
data cloned to a lower amount. There are several benefits of implementing the
git-lfs protocol, instead of using the largefiles extension:
- Bitbucket and Github support (and probably wider support in 3rd party
hosting sites in general). [1][2]
- The number of hg internals monkey patched are several orders of magnitude
lower, so it will be easier to reason about and maintain. Future commands
will likely just work, without requiring various wrappers.
- The "standin" files are only written to the filelog, not the disk. That
should avoid weird edge cases where the largefile and standin files get out
of sync. [3] It also avoids the occasional printing of the "hidden" standin
file in various messages.
- Filesets like size() will work, even if the file isn't present. (It always
says 41 bytes for largefiles, whether present or not.)
The only place that I see where largefiles comes out on top is that it works
with `hg serve` for simple sharing, without external infrastructure. Getting
lfs-test-server working was a hassle, and took awhile to figure out. Maybe we
can do something to make it work in the future.
Long term, I expect that this will be highly preferred over largefiles. But if
we are to recommend this to largefile users, there are some UI issues to
bikeshed. Until they are resolved, I've marked this experimental, and am not
putting a pointer to this in the largefiles help. The (non exhaustive) list of
issues I've seen so far are:
- It isn't sufficient to just enable the largefiles extension- you have to
explicitly add a file with --large before it will pay attention to the
configured sizes and patterns on future adds. The justification being that
once you use it, you're stuck with it. I've seen people confused by this,
and haven't liked it myself. But it's also saved me a few times. Should we
do something like have a specific enabling config setting that must be set
in the local repo config, so that enabling this extension in the user or
system hgrc doesn't silently start storing lfs files?
- The largefiles extension adds a repo requirement when the first largefile is
committed, so that the extension must always be enabled in the future. This
extension is not doing that, and since I only enabled it locally to avoid
infecting other repos, I got a cryptic error about missing flag processors
when I cloned. Is there no repo requirement due to shallow/narrow clone
considerations (or other future advanced things)?
- In the (small amount of) reading I've done about the git implementation, it
seems that the files and sizes are stored in a tracked .gitattributes file.
I think a tracked file for this would be extremely useful for consistency
across developers, but this kind of touches on the tracked hgrc file
proposal a few months back.
- The git client can specify file patterns, not just sizes.
- The largefiles extension has a cache directory in the local repo, but also a
system wide one. We should probably implement a system wide cache too, so
that multiple clones don't have to refetch the files from the server.
- Jun mentioned other missing features, like SSH authentication, gc, etc.
The code corresponds to c0492b73c7ef in hg-experimental. [4] The only tweaks
are to load the extension in the tests with 'lfs=' instead of
'lfs=$TESTDIR/../hgext3rd/lfs', change the import in the *.py test to hgext
(from hgext3rd), add the 'testedwith' declaration, and mark it experimental for
now. The infinite-push, p4fastimport, and remotefilelog tests were left behind.
The devel-warnings for unregistered config options are not corrected yet, nor
are the import check warnings.
[1] https://www.mercurial-scm.org/pipermail/mercurial/2017-November/050699.html
[2] https://bitbucket.org/site/master/issues/3843/largefiles-support-bb-3903
[3] https://bz.mercurial-scm.org/show_bug.cgi?id=5738
[4] https://bitbucket.org/facebook/hg-experimental
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 14 Nov 2017 00:06:23 -0500 |
parents | fbfecd1dbfb5 |
children | 4441705b7111 |
rev | line source |
---|---|
28950
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
1 mock bugzilla driver for testing template output: |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
2 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
3 $ cat <<EOF > bzmock.py |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
4 > from __future__ import absolute_import |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
5 > from mercurial import extensions |
33432
fbfecd1dbfb5
configitems: register the 'bugzilla.mocklog' config
Boris Feld <boris.feld@octobus.net>
parents:
29102
diff
changeset
|
6 > from mercurial import registrar |
28950
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
7 > |
33432
fbfecd1dbfb5
configitems: register the 'bugzilla.mocklog' config
Boris Feld <boris.feld@octobus.net>
parents:
29102
diff
changeset
|
8 > configtable = {} |
fbfecd1dbfb5
configitems: register the 'bugzilla.mocklog' config
Boris Feld <boris.feld@octobus.net>
parents:
29102
diff
changeset
|
9 > configitem = registrar.configitem(configtable) |
fbfecd1dbfb5
configitems: register the 'bugzilla.mocklog' config
Boris Feld <boris.feld@octobus.net>
parents:
29102
diff
changeset
|
10 > |
fbfecd1dbfb5
configitems: register the 'bugzilla.mocklog' config
Boris Feld <boris.feld@octobus.net>
parents:
29102
diff
changeset
|
11 > configitem('bugzilla', 'mocklog', |
fbfecd1dbfb5
configitems: register the 'bugzilla.mocklog' config
Boris Feld <boris.feld@octobus.net>
parents:
29102
diff
changeset
|
12 > default=None, |
fbfecd1dbfb5
configitems: register the 'bugzilla.mocklog' config
Boris Feld <boris.feld@octobus.net>
parents:
29102
diff
changeset
|
13 > ) |
28950
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
14 > def extsetup(ui): |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
15 > bugzilla = extensions.find('bugzilla') |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
16 > class bzmock(bugzilla.bzaccess): |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
17 > def __init__(self, ui): |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
18 > super(bzmock, self).__init__(ui) |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
19 > self._logfile = ui.config('bugzilla', 'mocklog') |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
20 > def updatebug(self, bugid, newstate, text, committer): |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
21 > with open(self._logfile, 'a') as f: |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
22 > f.write('update bugid=%r, newstate=%r, committer=%r\n' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
23 > % (bugid, newstate, committer)) |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
24 > f.write('----\n' + text + '\n----\n') |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
25 > def notify(self, bugs, committer): |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
26 > with open(self._logfile, 'a') as f: |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
27 > f.write('notify bugs=%r, committer=%r\n' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
28 > % (bugs, committer)) |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
29 > bugzilla.bugzilla._versions['mock'] = bzmock |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
30 > EOF |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
31 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
32 set up mock repository: |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
33 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
34 $ hg init mockremote |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
35 $ cat <<EOF > mockremote/.hg/hgrc |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
36 > [extensions] |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
37 > bugzilla = |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
38 > bzmock = $TESTTMP/bzmock.py |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
39 > |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
40 > [bugzilla] |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
41 > version = mock |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
42 > mocklog = $TESTTMP/bzmock.log |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
43 > |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
44 > [hooks] |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
45 > incoming.bugzilla = python:hgext.bugzilla.hook |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
46 > |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
47 > [web] |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
48 > baseurl=http://example.org/hg |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
49 > |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
50 > %include $TESTTMP/bzstyle.hgrc |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
51 > EOF |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
52 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
53 $ hg clone -q mockremote mocklocal |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
54 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
55 push with default template: |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
56 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
57 $ echo '[bugzilla]' > bzstyle.hgrc |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
58 $ echo foo > mocklocal/foo |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
59 $ hg ci -R mocklocal -Aqm 'Fixes bug 123' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
60 $ hg -R mocklocal push -q |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
61 $ cat bzmock.log && rm bzmock.log |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
62 update bugid=123, newstate={}, committer='test' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
63 ---- |
29102
22c53b3a390d
tests: add globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
28950
diff
changeset
|
64 changeset 7875a8342c6f in repo $TESTTMP/mockremote refers to bug 123. (glob) |
28950
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
65 details: |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
66 Fixes bug 123 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
67 ---- |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
68 notify bugs={123: {}}, committer='test' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
69 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
70 push with style: |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
71 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
72 $ cat <<EOF > bzstyle.map |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
73 > changeset = "{node|short} refers to bug {bug}." |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
74 > EOF |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
75 $ echo "style = $TESTTMP/bzstyle.map" >> bzstyle.hgrc |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
76 $ echo foo >> mocklocal/foo |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
77 $ hg ci -R mocklocal -qm 'Fixes bug 456' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
78 $ hg -R mocklocal push -q |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
79 $ cat bzmock.log && rm bzmock.log |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
80 update bugid=456, newstate={}, committer='test' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
81 ---- |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
82 2808b172464b refers to bug 456. |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
83 ---- |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
84 notify bugs={456: {}}, committer='test' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
85 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
86 push with template (overrides style): |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
87 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
88 $ cat <<EOF >> bzstyle.hgrc |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
89 > template = Changeset {node|short} in {root|basename}. |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
90 > {hgweb}/rev/{node|short}\n |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
91 > {desc} |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
92 > EOF |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
93 $ echo foo >> mocklocal/foo |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
94 $ hg ci -R mocklocal -qm 'Fixes bug 789' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
95 $ hg -R mocklocal push -q |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
96 $ cat bzmock.log && rm bzmock.log |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
97 update bugid=789, newstate={}, committer='test' |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
98 ---- |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
99 Changeset a770f3e409f2 in mockremote. |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
100 http://example.org/hg/rev/a770f3e409f2 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
101 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
102 Fixes bug 789 |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
103 ---- |
9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
104 notify bugs={789: {}}, committer='test' |