Commit Graph

922 Commits

Author SHA1 Message Date
Mateusz Kwapich
ccdc9763be hgsuversion: move docs and tools
Summary: Moves various tools from hgsubversion/ to contrib/hgsubversion

Test Plan: N/A

Reviewers: quark, #mercurial

Reviewed By: quark

Differential Revision: https://phabricator.intern.facebook.com/D6698604

Signature: 6698604:1515628552:cfae17dcfdbc96d978a6af5c19dfa1032e8aa48c
2018-01-10 16:20:15 -08:00
Mateusz Kwapich
b1e4b49084 hgsubversion: move hgsubversion/tests to tests/hgsubversion
Test Plan: Tests are made to pass in later commits.

Reviewers: quark, #mercurial

Reviewed By: quark

Differential Revision: https://phabricator.intern.facebook.com/D6698523

Signature: 6698523:1515628418:39f509c8422cdc223f5e84ae18dfd7cfe9344b2e
2018-01-10 16:19:55 -08:00
Mateusz Kwapich
ba6e9cd752 hgsubversion: move hgsubversion/hgsubversion to hgext
Summary: Move's the extension code into hgext/

Test Plan: Tests are fixed in a later commit.

Reviewers: quark, #mercurial

Reviewed By: quark

Differential Revision: https://phabricator.intern.facebook.com/D6698506

Signature: 6698506:1515628404:0006a07cef299eb3cd719f2fc0d5d381fdc2a3d5
2018-01-10 16:19:46 -08:00
Ryan McElroy
00e6e6f4bd hgsubversion: changes to pass check-code 2018-01-03 11:51:20 -08:00
Ryan McElroy
07414ea9ea hgsubversion: fix pyflakes issues 2018-01-03 11:51:00 -08:00
Mark Thomas
502d10f824 hgsubversion: move into hgsubversion dir 2018-01-03 07:17:44 -08:00
Jun Wu
7760c1b631 sqliterevmap: break ".hashes()" cycle in a safer way
The `fromsvn()` revset implementation could cause weakref error when using
sqliterevmap like:

  File "hgsubversion/util.py", line 357, in <lambda>
    return subset.filter(lambda r: tonode(r) in hashes)
  File "hgsubversion/maps.py", line 542, in __contains__
    return self.get(key) != None
  File "hgsubversion/maps.py", line 533, in get
    for row in self.revmap._query(
  ReferenceError: weakly-referenced object no longer exists

Basically the seemingly harmless assignment could break surprisingly:

  # dangerous: `hashes` does not have a reference on `meta.revmap` and may
  # become unavailable after `meta`, `revmap` are released.
  hashes = meta.revmap.hashes()

Avoiding cycles is still nice. This patch removes `revmap._hashes` so the
revmap no longer owns a reference of a `ReverseRevMap` object so the
`ReverseRevMap` object no longer needs to use weakref for `self.revmap`.

This could actually be caught by `comprehensive/test_sqlite_revmap.py`.
I was not careful enough verifying the "fromsvn()" patch.
2017-12-21 17:20:21 -08:00
Jun Wu
c44c87c850 compathacks: be compatible with upstream 0980979a0d48 memfilectx change
See hg change 0980979a0d48. Since the interface has changed
more than one time, switch to explicit keywords arguments to avoid
surprises.

Since hgsubversion targets hg >= 3.2.4, drop support for hg 3.0 and 3.1
here.
2017-12-19 14:29:55 -08:00
Jun Wu
1b11aee6d4 revset: fix ordering issue of "svnrev()"
This is subtle. See
https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-August/103368.html
for the context.  Basically, `subset & x` (instead of `x & subset`)
should be used to make order correct given the current revset API.
2017-12-19 14:19:00 -08:00
Jun Wu
3ca74b2307 revset: make "fromsvn()" lazy
"fromsvn()" could be a huge revset. Therefore a lazy version makes more
sense.  This also resolves a subtle ordering issue.  See
https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-August/103368.html
for the context.
2017-12-19 14:18:01 -08:00
Jun Wu
1a26cec9d9 help: reword revmapimpl text
The old text has issues in grammar.
2017-12-19 11:59:09 -08:00
Augie Fackler
d8ea5d2f0c testedwith: add hg 4.4 2017-11-01 22:37:11 -04:00
Augie Fackler
2d3ef45320 config: don't use the config registrar on hg that lacks dynamicdefault
Some versions of hg have bits of the config registrar code, but lack
dynamicdefault. Despite that, if they see reigstered config knobs,
they'll set off devel-warn nonsense about how you're holding the
config system wrong.

Ugh.
2017-10-29 09:06:57 -04:00
Augie Fackler
1356d30869 hgsubversion: cope with configitem registration soft-required by hg 4.4 2017-10-25 22:06:40 -04:00
Augie Fackler
e01caaf8be svnrepo: use configlist instead of rolling it ourselves 2017-10-25 22:57:29 -04:00
Augie Fackler
83482b21ab svnrepo: move password_stores config to a property
The config registrar doesn't load extension config values until after
a repo is created, meaning you can't access non-core config items in a
repository constructor.
2017-10-25 22:11:15 -04:00
Augie Fackler
338ef57041 svnmeta: specify default for revmapimpl config option 2017-10-25 22:10:05 -04:00
Augie Fackler
12e8bfd305 wrappers: add some missing lock/wlock grabbing
Caught with a hack to turn develwarns into crashes. Unfortunately, I
can't check that in because a couple of commitctx() calls in tests
turn into deadlocks when I try and fix them.
2017-10-25 20:46:54 -04:00
Augie Fackler
c4ea74ca31 svnrepo: wrap too-wide abort message 2017-10-25 22:10:22 -04:00
Augie Fackler
169abfa9e6 hg: prune old unsupported versions 2017-08-31 01:19:56 -04:00
Augie Fackler
9fc6ade3cb meta: more forceutf8 love, this time on subdir handling 2017-08-31 23:02:40 -04:00
Augie Fackler
d7dab2eaa1 subvertpy: ensure paths are really always bytes 2017-08-31 01:19:11 -04:00
Augie Fackler
b343f88a75 meta: force date and extra fields to be purely bytes 2017-08-31 01:18:48 -04:00
Augie Fackler
bdfdf28cce meta: force user and message to be bytes 2017-08-31 01:18:19 -04:00
Augie Fackler
59e0fa949e util: add method for forcing unicode objects back to utf8 bytes
Use this to force all filenames to be bytes, even when underlying svn
bindings really want to give us unicodes instead.
2017-08-31 00:45:27 -04:00
Augie Fackler
5fb2fea2a4 svnwrap: work around getting a bytearray instead of a string in SimpleStringIO 2017-08-30 23:58:15 -04:00
Augie Fackler
af0c0307be svnwrap: clean up whitespace in common 2017-08-30 23:57:42 -04:00
Mateusz Kwapich
83e3ff0ac2 util: don't assume that converted rev is an svn rev
Summary:
In repos where converted revisions come from different sources it's
not nice of hgsubversion to assume that all converted rev are coming
from SVN.

Test Plan:
Ran all current tests, nothing is broken. Not sure how to test new
behaviour withour much overhead. I suppose I could write something
that overrides commit extras
2017-10-24 07:36:35 -07:00
Jun Wu
ed7c8d0b9a revset: accept additional arguments
The upstream is going to add an `order` argument to `revset.methods`
functions. Let's update our code to be compatible with it.

[1]: https://phab.mercurial-scm.org/D451
2017-08-28 10:15:18 -07:00
Jun Wu
f57a657ba6 svnrepo: update with the latest upstream change
The Mercurial upstream had a massive change on wireproto interface recently.
Update code to be compatible with both versions.
2017-08-21 15:19:12 -07:00
Jun Wu
e61ba688f2 maps: handle sqlite lock error triggered by PRAGMA statements
"self._db.execute('PRAGMA cache_size=%d' % (-cachesize))" could raise
"OperationalError: database is locked". Therefore move PRAGMA statements
inside "self._transaction" which handles the "locked" error automatically.
2017-08-11 09:24:29 -07:00
Jun Wu
def3fcbc83 push: lock repo before calling createmarkers
Previously, when devel.all-warnings is set to True, hg subversion will crash
when pushing with the error:

  ProgrammingError: transaction requires locking

Tracking that down, that is because "createmarkers" was called without
locking.

A comprehensive test was added to run test_push_command with obsstore turned
on to cover the code paths.
2017-08-07 18:12:16 -07:00
Durham Goode
d2fc784820 subrepo: add missing arg to dirty()
Upstream Mercurial has added a new 'missing' argument to the dirty function. We
need to add it as well. The default argument should mean this is backwards
compatible with older Mercurials.

I don't understand the subrepo or hgsubverison code 100%, so this patch is my
best attempt at a fix.
2017-07-11 16:37:57 -07:00
Durham Goode
0543b7d9df subrepo: refactor dirty() to be cleaner
A future patch will modify dirty() to match an upstream change. Let's first
refactor it to be a bit cleaner so the next patch is readable.

This patch should not change any logic.
2017-07-11 16:34:59 -07:00
Durham Goode
095f91fe31 obsolete: support obsolete.isenabled
obsolete._enabled is the old deprecated way of checking if obsolete markers is
on. Instead we should be using obsolete.isenabled() to check if individual
features are on.
2017-06-28 13:31:17 -07:00
Durham Goode
b044d8d8c6 commands: fix command option registering
A recent patch introduced svnopts as a way of sharing the svn command options
between the old and the new way of registering a command. It turns out 'svnopts'
was already used further up in the module to define the flags that should be
added to *all* Mercurial commands. So our definition of it here cause us to add
all of these options to all Mercurial commands.

This was caught because it changes --rev to be '' instead of [], which breaks a
number of assumptions in the other commands.

Given that none of the subversion tests are command line tests, I'm not sure how
to test this. It was caught in other extensions tests.
(grafted from 3b1334407783a4379fd515e2ed9acc61e3f175ff)
(grafted from 6db63ead5556f2bf72e423ca8c6df08ea3a5b009)
2017-05-24 15:07:00 -07:00
Stanislau Hlebik
77bb30b4ae replay: fix tests
Upstream 4b674dc38eeae9fa5e7794da8dc951ebadc23877 now may set current branch if
branch is not set in extras explicitly. This diff fixes it.
2017-06-07 03:35:44 -07:00
Ivan Lezhankin
1f5dca311f svnwrap: don't add paths to revision outside of subdir
It prevents from closing the default branch on some occasional removal of
directory from outside of subdir in a single layout.
2017-05-23 15:09:02 +03:00
Durham Goode
11ae5350fb commands: fix registrar check
'util' in hgsubversion is a different type from hgutil, which is the one from
core hg. This was hidden by the fallback logic, but I'm not sure why it didn't
cause errors in the tests. Maybe I ran the original tests against an older hg.

This time I've ensured the tests pass against the latest version of hg.
2017-05-23 11:08:42 -07:00
Durham Goode
cc02fc30dd commands: update to work with new registrar.commands()
Core hg has deprecated cmdutil.commands in favor of registrar.commands. This
patch adds support for that pattern, as well as the old pattern.
2017-05-22 14:30:37 -07:00
Durham Goode
fb7a2fcea5 clone: add try/finally to unwrap
While fixing other test failures, I saw stack overflows related to the clone
function being wrapped too many times. I believe it's because this wrapping
logic doesn't put the unwrap logic in a finally statement.

This particularly bad in the tests, which do many things in one process. Hence
the stack overflow.
2017-05-09 15:23:34 -07:00
Durham Goode
b05b7d809c join: remove uses of repo.join/wjoin
Upstream Mercurial has dropped these functions as of 4.3. Let's switch to the
appropriate repo.[w]vfs.join functions.
2017-05-09 15:20:16 -07:00
Arun Kulshreshtha
6f9e780128 util: return baseset instead of plain list from revset
Support for returning plain lists from revset predicates was recently removed.
(See: https://www.mercurial-scm.org/repo/hg/rev/ed363a84f9ac)
2017-04-21 13:43:59 -07:00
Augie Fackler
ac09ae970f Merge default heads.
Cleaned up some comments in wrappers as a result of duplicate work. Sigh.
2017-02-12 16:35:08 -05:00
Augie Fackler
6468047abe Merge with stable. 2017-02-12 16:30:28 -05:00
Augie Fackler
73bb66d0f0 findcommonoutgoing: adapt to change to take a repo rather than changelog 2017-02-12 15:16:51 -05:00
Stanislau Hlebik
bc0d23b726 fix tests
`outgoing.__init__` in Mercurial >3.9.1 accepts repo object instead of a
changelog
2016-10-10 08:09:17 -07:00
Jun Wu
345ef20c2f SqliteRevMap: wait indefinitely for database lock
Python sqlite has 5 seconds timeout by default, which means if a writer holds
the lock, and the second writer will error out after 5 seconds.

In our use-case, it makes sense to just wait. However, sqlite does not support
waiting forever (see sqlite3_busy_timeout). Therefore use a while loop to
workaround.
2016-07-19 20:34:11 +01:00
Augie Fackler
5851f26e18 Merge with stable. 2016-06-26 21:10:36 -04:00
Augie Fackler
fb3884d062 editor: fix RevisionData to not leak temporary directories 2016-06-26 21:06:50 -04:00