Commit Graph

358 Commits

Author SHA1 Message Date
Mads Kiilerich
a723522899 largefiles: don't prompt when one side of merge was changed but didn't change
This can happen after backout or grafts or criss cross merges. We already do
the same (but slightly different) thing in manifestmerge and filemerge.
2014-04-07 23:10:20 +02:00
Matt Mackall
c9eb4517fa merge with stable 2014-04-01 15:11:19 -05:00
FUJIWARA Katsunori
01d8b27701 i18n: fix "% inside _()" problems
Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that the format string and "%" aren't placed in the
same line.

This patch replaces "\s" in that regexp pattern with "[ \t\n]" to
detect "% inside _()" problems in such case.

"[\s\n]" can't be used in this purpose, because "\s" is automatically
replaced with "[ \t]" by "_preparepats()" and "\s" in "[]" causes
nested "[]" unexpectedly.
2014-04-01 02:46:03 +09:00
FUJIWARA Katsunori
920a8f861c hg: introduce "wirepeersetupfuncs" to setup wire peer by extensions (issue4109)
Since changeset a8955c4d9ef5, "reposetup()" of each extensions is
invoked only on repositories enabling corresponded extensions.

This causes that largefiles specific interactions between the
repository enabling largefiles locally and remote (wire) peer fail,
because there is no way to know whether largefiles is enabled on the
remote repository behind the wire peer, and largefiles specific
"wireproto functions" are not given to any wire peers.

To avoid this problem, largefiles should be enabled in wider scope
than each repositories (e.g. user-wide "${HOME}/.hgrc").

This patch introduces "wirepeersetupfuncs" to setup wire peer by
extensions already enabled. Functions registered into
"wirepeersetupfuncs" are invoked for all wire peers.

This patch uses plain list instead of "util.hooks" for
"wirepeersetupfuncs", because the former allows to control order of
function invocation by order of extension enabling: it may be useful
for workaround of problems with combination of enabled extensions
2014-03-29 01:20:07 +09:00
Kevin Bullock
c63d1fcf68 merge with stable
This should correct an earlier couple of bad merges (5433856b2558 and
596960a4ad0d, now pruned) that accidentally brought in a change that had
been marked obsolete (244ac996a821).
2014-03-31 10:12:07 -05:00
Mads Kiilerich
2629efac4f config: set a 'source' in most cases where config don't come from file but code
Some extensions set configuration settings that showed up in 'hg showconfig
--debug' with 'none' as source. That was confusing.

Instead, they will now tell which extension they come from.

This change tries to be consistent and specify a source everywhere - also where
it perhaps is less relevant.
2014-03-19 02:45:14 +01:00
Augie Fackler
ad0fddea79 check-code: disallow use of dict(key=value) construction
{} literals are faster and more consistent across Python 2 and 3.

Whitelisted the one use of dict() that is using a generator expresion.
2014-03-12 13:31:27 -04:00
Mads Kiilerich
7ee3d68332 largefiles: override calculateupdates instead of manifestmerge
That will give calculateupdates a purpose in life ... and be convenient later.
2014-03-02 18:30:41 +01:00
Lucas Moscovicz
e0f8aa1f35 hgext: updated extensions to return a baseset when adding symbols 2014-02-11 09:00:38 -08:00
Mads Kiilerich
5c02304224 largefiles: stylistic cleanup of filemerge 2013-11-16 15:54:41 -05:00
Mads Kiilerich
19967e8476 largefiles: show hashes before prompting for conflict resolution
The largefile hashes are mostly an implementation detail, but they are "leaked"
in several places anyway, and showing the hashes is better than not giving the
user any information about the options in the prompt.

The hashes are long, but it is largefile hashes and it would thus be confusing
to shorten them.
2013-11-16 15:46:29 -05:00
Mads Kiilerich
d6cfe18be7 largefiles: don't try to explain rename history before prompt for conflicts
Before it tried to explain the exact situation when merging moved largefiles.
That do not happen for normal merges and is not more relevant for largefiles
than for normal files. It is unneeded complexity - remove it.
2013-11-16 15:46:29 -05:00
Mads Kiilerich
af7f586373 largefiles: drop redundant special handling of merges of renames
It is unclear what cases this was supposed to cover but it do no longer seem
relevant.
2013-11-16 15:46:29 -05:00
Long Vu
718cfe2dd3 largefiles: call super class method with proper kwargs to respect API
Since the localrepositoyry.push() method in mercurial/localrepo.py is defined
this way:

  def push(self, remote, force=False, revs=None, newbranch=False):

it is better for largefiles to call push() on the super class with proper
kwargs to respect the API.

This will avoid breaking other extensions overriding the push method this way:

  def push(self, remote, force=False, **kwargs):
2013-12-03 13:28:04 -05:00
Matt Mackall
4223982ebe merge with stable 2013-12-01 14:10:53 -06:00
Mads Kiilerich
f2255e8146 largefiles: don't crash on 'local renamed directory' actions
a8386b4c47b1 introduced splitstandin on all action filenames. It would however
crash on 'd' actions where the filename is None.

Fix that and add test coverage for that case.
2013-11-26 15:38:33 +01:00
Mads Kiilerich
c73c847849 largefiles: update in two steps, handle interrupted updates better
An update would try to fetch any missing largefiles after having updated normal
files and standins. That could fail or be interrupted and would leave the
working directory in a state where the largefiles not only were missing but
also were scheduled for remove ... and where the old largefile was left in
place.

Instead we now remove old largefiles before starting to download and update
missing largefiles.
2013-11-07 01:56:40 +01:00
Mads Kiilerich
6b59065762 largefiles: inline _updatelfile, prepare for further refactorings 2013-11-07 01:49:48 +01:00
Mads Kiilerich
3f82a98b8e largefiles: cache largefiles for update, also without printmessage 2013-11-07 01:48:00 +01:00
Mads Kiilerich
90dc6e20e1 largefiles: cleanup of printmessage handling - the printed flag was redundant 2013-11-07 01:47:59 +01:00
Matt Mackall
6c7d99a18d merge with stable 2013-11-17 20:22:59 -05:00
Augie Fackler
213fff305a pathutil: tease out a new library to break an import cycle from canonpath use 2013-11-06 18:19:04 -05:00
Mads Kiilerich
3c628b9e09 largefiles: use 'remote'/'local' in merge prompts like in other merge prompts
Prompts like
  foo has been turned into a largefile
  use (l)argefile or keep as (n)ormal file?
was not as clear as the usual prompts that use 'remote' or 'local' to explain
what happened on which side ... especially not when used to the normal prompts.

"as" could also indicate that it would be possible to take the content of the
largefile and somehow put it into the normal file. It could make it more clear
that it was a choice between one side or the other.

For consistency we will now phrase it like:
  remote turned local normal file f into a largefile
  use (l)argefile or keep (n)ormal file?
2013-10-28 22:34:07 +01:00
Mads Kiilerich
bcec8229ea largefiles: don't prompt for normal/largefile changes when doing plain updates
We used to get like:

  $ hg up -r 2
  foo has been turned into a normal file
  keep as (l)argefile or use (n)ormal file? l
  getting changed largefiles
  0 largefiles updated, 0 removed
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ cat foo
  cat: foo: No such file or directory
  [1]

- which both asked the wrong question and did the wrong thing.

Instead, skip this conflict resolution when the local conflicting file has been
scheduled for removal and there thus is no conflict.
2013-10-25 02:33:59 +08:00
Mads Kiilerich
d2031cc679 largefiles: remove extra check for file to get - it _is_ by definition in p2 2013-10-25 02:25:10 +08:00
Mads Kiilerich
db98125811 largefiles: don't process merge actions at all when overwriting 2013-10-25 01:24:10 +08:00
Mads Kiilerich
63e01aeb0a largefiles: hide passwords in URLs in ui messages 2013-10-17 16:13:15 +08:00
Mads Kiilerich
59f7203fee largefiles: don't add extra \n when displaying remote messages in putlfile 2013-10-24 01:49:56 +08:00
Mads Kiilerich
46512da6c4 largefiles: add missing \n in ui.warn messages 2013-10-21 11:22:54 +08:00
Mads Kiilerich
ee0298712d largefiles: fix 'unexpected response' warning newlines
Warnings should always end with \n. The warning message might contain or end
with \n, so better show it with repr encoding.
2013-10-24 01:49:56 +08:00
FUJIWARA Katsunori
fb1d8fd59b localrepo: invoke only feature setup functions for enabled extensions
Before this patch, each feature setup functions for localrepository
class should examine whether corresponding extension is enabled or not
by themselves.

This patch invokes only feature setup functions defined in module of
enabled extensions, and it makes implementation of feature setup
functions easier and simpler.
2013-10-17 21:45:17 +09:00
Mads Kiilerich
72342dd16e largefiles: refactor basestore, extract _gethash method 2013-10-10 04:28:44 +02:00
Mads Kiilerich
aff7af83da largefiles: make the protocol hack for replacing heads with lheads more precise
Before the hack would replace 'heads' with 'lheads' no matter where it occured
in a batch command string.

Instead we will use a regexp to more carefully only match the 'heads' commands.
2013-10-10 04:28:39 +02:00
Siddharth Agarwal
99a29f5838 largefiles: standardize error message for dirty working dir 2013-09-23 21:41:01 -07:00
FUJIWARA Katsunori
0b216b06c5 largefiles: setup "largefiles" feature in each repositories individually
Before this patch, if largefiles extension is enabled once in any of
target repositories, commands handling multiple repositories at a time
like below misunderstand that "largefiles" feature is supported also
in all other local repositories:

  - clone/pull from or push to localhost
  - recursive execution in subrepo tree

This patch registers "featuresetup()" into "featuresetupfuncs" of
"localrepository" to support "largefiles" features only in
repositories enabling largefiles extension, instead of adding
"largefiles" feature to class variable "_basesupported" of
"localrepository".

This patch also adds checking below to the largefiles specific class
derived from "localrepository":

  - push to localhost: whether features supported in the local(= dst)
    repository satisfies ones required in the remote(= src)

This can prevent useless looking up in the remote repository, when
supported and required features are mismatched: "push()" of
"localrepository" also checks it, but it is executed after looking up
in the remote.
2013-09-21 21:33:29 +09:00
FUJIWARA Katsunori
c1e7da5d4f localrepo: make supported features manageable in each repositories individually
Before this patch, all localrepositories support same features,
because supported features are managed by the class variable
"supported" of "localrepository".

For example, "largefiles" feature provided by largefiles extension is
recognized as supported, by adding the feature name to "supported" of
"localrepository".

So, commands handling multiple repositories at a time like below
misunderstand that such features are supported also in repositories
not enabling corresponded extensions:

  - clone/pull from or push to localhost
  - recursive execution in subrepo tree

"reposetup()" can't be used to fix this problem, because it is invoked
after checking whether supported features satisfy ones required in the
target repository.

So, this patch adds the set object named as "featuresetupfuncs" to
"localrepository" to manage hook functions to setup supported features
of each repositories.

If any functions are added to "featuresetupfuncs", they are invoked,
and information about supported features is managed in each
repositories individually.

This patch also adds checking below:

  - pull from localhost: whether features supported in the local(= dst)
    repository satisfies ones required in the remote(= src)

  - push to localhost: whether features supported in the remote(= dst)
    repository satisfies ones required in the local(= src)

Managing supported features by the class variable means that there is
no difference of supported features between each instances of
"localrepository" in the same Python process, so such checking is not
needed before this patch.

Even with this patch, if intermediate bundlefile is used as pulling
source, pulling indirectly from the remote repository, which requires
features more than ones supported in the local, can't be prevented,
because bundlefile has no information about "required features" in it.
2013-09-21 21:33:29 +09:00
Siddharth Agarwal
3f3eb7081b largefiles: remove bailifchanged check from overridepull (BC)
This brings pull --rebase with largefiles in line with pull --rebase without.
2013-09-20 15:26:30 -07:00
Sean Farley
fbb07e88d9 largefiles: remove unnecessary check of instance
The refactoring of all the context objects allows us to simply pass a basectx
to the __new__ constructor and have it return the same object without
allocating new memory.

This also removes the need to import the context module.
2013-08-06 15:10:09 -05:00
Wei, Elson
8a3265a449 largefiles: overridematch() should replace the file path instead of extending (issue3934) 2013-07-24 13:20:44 +08:00
Matt Mackall
13d2a13ea6 ui: merge prompt text components into a singe string
This will help avoid problems with partial or mismatched translation
of the components.
2013-05-22 17:31:43 -05:00
FUJIWARA Katsunori
72d4082125 largefiles: check unknown files with case awareness of the filesystem
Before this patch, largefiles extension checks unknown files in the
working directory always case sensitively.

This causes failure in updating from the revision X consisting of
'.hglf/A' (and "A" implicitly) to the revision Y consisting of 'a'
(not ".hglf/A") on case insensitive filesystem, because "A" in the
working directory is treated as colliding against and different from
'a' on the revision Y.

This patch uses "repo.dirstate.normalize()" to check unknown files
with case awareness of the filesystem.
2013-05-07 05:04:11 +09:00
FUJIWARA Katsunori
1d7c1875df largefiles: check existence of the file with case awareness of the filesystem
Before this patch, largefiles extension always unlinks largefiles
untracked on the target context in merging/updating after updating
working directory.

For example, it is assumed that the revision X consists of ".hglf/A"
(and "A" implicitly) and revision Y consists of "a" (not ".hglf/A").

In the case of updating from X to Y, largefiles extension tries to
unlink "A" after updating "a" in working directory. This causes
unexpected unlinking "a" on the case insensitive filesystem.

This patch checks existence of the file in the working context with
case awareness of the filesystem to prevent from such unexpected
unlinking.

"lfcommands._updatelfile()" also unlinks target file in the case
"largefile is tracked in the target context, but fails to be fetched".

This patch doesn't apply "repo.dirstate.normalize()" in this case,
because it should be already ensured in the manifest merging that
there is no normal file colliding against any largefiles.
2013-05-07 05:04:11 +09:00
Mads Kiilerich
69da8bff75 largefiles: use repo.wwrite for writing standins (issue3909) 2013-04-27 00:41:42 +02:00
Mads Kiilerich
2f9545c92c largefiles: drop repo wrapping detection
After 08202d1ef738 I see:

  $ hg id -q
  largefiles: repo method 'commit' appears to have already been wrapped by another extension: largefiles may behave incorrectly
  largefiles: repo method 'push' appears to have already been wrapped by another extension: largefiles may behave incorrectly
  3bd0c95ec1bf

The warning is bad:

* The message gives no hint what the problem is and how it can be resolved.
  The message is useless.

* Largefiles do have its share of problems, but I don't think I ever have seen
  a problem where this warning would have helped. The 'may' in the warning
  seems like an exaggeration of the risk. Having largefiles enabled in
  combination with for instance mq, hggit and hgsubversion causes a warning
  (depending on the configuration order) but do not cause problems. Extensions
  might of course be incompatible, but they can be that in many other ways.
  The check and the message are incorrect.

It would thus be better to remove the check and the warning completely.

Before 08202d1ef738 the check always failed. That change made the check work
more like intended ... but the intention was wrong. This change will thus also
back that change out.
2013-04-26 19:04:01 +02:00
Wagner Bruna
bf79f90e32 largefiles: fix typos in documentation 2013-04-19 18:26:35 -03:00
Mads Kiilerich
ec228a65b1 largefiles: wlock in status before lfdirstate.write() 2013-04-17 03:41:11 +02:00
Mads Kiilerich
9c2c68a468 largefiles: don't hash all largefiles when initializing a lfdirstate
The largefiles will be hashed on demand if necessary ... and sometimes it isn't
necessary.
2013-04-15 23:31:56 +02:00
Mads Kiilerich
9a6bd8ef12 largefiles: use filechunkiter for iterating largefile when serving getlfile
The default file iterator is line based and will give odd chunk sizes - often
very short and relatively expensive.
2013-04-16 00:40:21 +02:00
Mads Kiilerich
208aa05eca largefiles: stat all largefiles in one batch before downloading
This avoids a lot of expensive roundtrips to remote repositories ... but might
be slightly slower for local operations.

This will also change some aborts on missing files to warnings. That will in
some situations make it possible to continue working on a repository with
missing largefiles.
2013-04-15 23:37:43 +02:00
Mads Kiilerich
f099974674 largefiles: 'put' should store 'source' file in under 'hash', also in localstore 2013-04-15 23:34:36 +02:00