Commit Graph

72 Commits

Author SHA1 Message Date
Mark Thomas
e09288137b ui: deprecate ui.progress
Summary:
Remove ui.progress as a method of updating progress.  All progress bars now go
through new-style progress bars.

This also splits out the rendering of progress bars from the reporting of
progress.  All tests are updated to use new-style debug progress bars, which
simply report the position of the progress bar.  Rendering of progress bars
will be tested separately once the progress bar engine has been rewritten.

Reviewed By: quark-zju

Differential Revision: D7329488

fbshipit-source-id: 14f8ab67365ddd98b74986aa25d9abc7a0546144
2018-04-13 21:51:34 -07:00
Mark Thomas
e0ebeb5325 subrepo: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329515

fbshipit-source-id: d35a7e4a6ad9a78da9b74863b83811dd4e9f2e9e
2018-04-13 21:51:32 -07:00
Mark Thomas
ded1a17e97 archiving: use new-style progress bars
Reviewed By: ryanmce

Differential Revision: D7329713

fbshipit-source-id: 49e6c17f7e54f6a728fc48cd6569ec1a7768cebe
2018-04-13 21:51:32 -07:00
Mark Thomas
f1508781f5 hg: use new-style progress bars for copystore
Summary:
Update hg.copystore and util.copyfiles to use the new-style progress bar
context manager.

Reviewed By: ryanmce

Differential Revision: D7329482

fbshipit-source-id: 4ac1def57e0ae4e7819c7c0c4d6f1715b8cbb625
2018-04-13 21:51:31 -07:00
Jun Wu
e3bbd1757c serve: assign hg serve ports dynamically (part 2)
Summary:
This is similar to what D6925398 does. But covers areas that D6925398 missed
because the codemod script wasn't able to handle multiple-line `hg serve`
commands.

Reviewed By: DurhamG

Differential Revision: D6937919

fbshipit-source-id: a67de178527c11a0ed8bbac82f0c46d44b81be77
2018-04-13 21:51:08 -07:00
Jun Wu
4a7b28d08b serve: assign hg serve ports dynamically in tests
Summary:
Previously `hg server` uses `HGPORT` that might be in use. This patch uses
`-p 0 --port-file ...` so `hg server` always gets assigned a free port.

The change was first made by the following Ruby script:

```
re = /^  \$ hg serve(.*) -p \$(HGPORT[12]?) (.*[^\\])$\n  \$/
Dir['*.t'].each do |path|
  old = File.read(path)
  new = old.lines.map do |l|
    next l if l[/\(glob\)/] or not l['$HGPORT'] or l[/^  [$>]/]
    "#{l.chomp} (glob)\n"
  end.join.gsub re, <<-'EOS'.chomp
  $ hg serve\1 -p 0 --port-file $TESTTMP/.port \3
  $ \2=`cat $TESTTMP/.port`
  $
  EOS
  File.write(path, new) if old != new
end
```

Then there are some manual changes:

run-tests.py: It now treats `$HGPORT` in output as glob pattern `*`, since
it does not know the assigned value in tests.

test-bookmarks-pushpull.t, test-https.t: Some `hg pull`s were changed to use
explicit paths instead of relying on `.hgrc` since the test restarts the
server and `.hg/hgrc` having an outdated URL.

test-schemes.t: The test writes `$HGPORT` to `.hgrc` before assigning it.
Changed the order so the correct `$HGPORT` is written.

test-patchbomb-tls.t: Changed `(?) (glob)` to `(glob) (?)`.

Reviewed By: DurhamG

Differential Revision: D6925398

fbshipit-source-id: d5c10476f43ce23f9e99618807580cf8ba92595c
2018-04-13 21:51:07 -07:00
Jun Wu
e81c53461e largefiles: remove the extension
Summary:
`lfs` is the better large file solution. `largefiles` is rarely used, and
its implementation is less clean. So let's remove it.

Test Plan:
Ran all tests. A subrepo test was removed instead of cleaned up since the
longer term plan is to also drop subrepo support.

Reviewers: phillco, #mercurial

Reviewed By: phillco

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

Signature: 6740361:1516225594:555e3803571ad05e0434021897a2823ac99347ae
2018-01-17 11:50:44 -08:00
Matt Harbison
7d8bebd9c1 tests: remove (glob) annotations that were only for '\' matches
# skip-blame because this was mechanically rewritten the following script.  I
ran it on both *.t and *.py, but none of the *.py changes were proper.  All *.t
ones appear to be, and they run without addition failures on both Windows and
Linux.

  import argparse
  import os
  import re

  ap = argparse.ArgumentParser()
  ap.add_argument('path', nargs='+')
  opts = ap.parse_args()

  globre = re.compile(r'^(.*) \(glob\)(.*)$')

  for p in opts.path:
      tmp = p + '.tmp'
      with open(p, 'rb') as src, open(tmp, 'wb') as dst:
          for line in src:
              m = globre.match(line)
              if not m or '$LOCALIP' in line or '*' in line:
                  dst.write(line)
                  continue
              if '?' in line[:-3] or ('?' in line[:-3] and line[-3:] != '(?)'):
                  dst.write(line)
                  continue
              dst.write(m.group(1) + m.group(2) + '\n')
      os.unlink(p)
      os.rename(tmp, p)
2017-12-10 22:50:57 -05:00
Denis Laxalde
9efc7f05e3 transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Upon pull or unbundle, we display a message with the range of new revisions
fetched. This revision range could readily be used after a pull to look out
what's new with 'hg log'. The algorithm takes care of filtering "obsolete"
revisions that might be present in transaction's "changes" but should not be
displayed to the end user.
2017-10-12 09:39:50 +02:00
Matt Harbison
86a2e6550a subrepo: make the output references to subrepositories consistent
Well, mostly.  The annotation on subrepo functions tacks on a parenthetical to
the abort message, which seems reasonable for a generic mechanism.  But now all
messages consistently spell out 'subrepository', and double quote the name of
the repo.  I noticed the inconsistency in the change for the last commit.
2017-07-09 16:13:30 -04:00
Matt Harbison
6d898e296f serve: add support for Mercurial subrepositories
I've been using `hg serve --web-conf ...` with a simple '/=projects/**' [paths]
configuration for awhile without issue.  Let's ditch the need for the manual
configuration in this case, and limit the repos served to the actual subrepos.

This doesn't attempt to handle the case where a new subrepo appears while the
server is running.  That could probably be handled with a hook if somebody wants
it.  But it's such a rare case, it probably doesn't matter for the temporary
serves.

The main repo is served at '/', just like a repository without subrepos.  I'm
not sure why the duplicate 'adding ...' lines appear on Linux.  They don't
appear on Windows (see 3f4ff1bdf101), so they are optional.

Subrepositories that are configured with '../path' or absolute paths are not
cloneable from the server.  (They aren't cloneable locally either, unless they
also exist at their configured source, perhaps via the share extension.)  They
are still served, so that they can be browsed, or cloned individually.  If we
care about that cloning someday, we can probably just add the extra entries to
the webconf dictionary.  Even if the entries use '../' to escape the root, only
the related subrepositories would end up in the dictionary.
2017-04-15 18:05:40 -04:00
Augie Fackler
a0c4b1e6da tests: work around FreeBSD's unzip having slightly different output
According to man 1 unzip, this unzip appeared in FreeBSD 8.0. It's
what comes as /usr/bin/unzip, so we may as well cater to it since it's
easy.
2017-01-18 23:43:41 -05:00
timeless
cb60f66ee7 tests: remove lines that enable progress extension
progress has not been an extension for a long time,
it has been integrated into core, thus these lines
have not done anything for a while.
2016-03-20 04:54:35 +00:00
Pierre-Yves David
792170e0e9 tests: clean up duplicated output in test-subrepo-recursion progress
We have fixed a bug where two progress instance were created and competed with
each other (in 29d8a6f6d7e4). But we did not updated the non-hardlink section of
'test-subrepo-recursion.t'. This patch fixes it.
2015-06-26 14:33:34 -07:00
Matt Harbison
0c2a919db5 test-subrepo-recursion: more aggressively regex 'unzip -l' output for 10.10
The output on 10.10 looks like this:

    Length     Date   Time    Name
   --------    ----   ----    ----
        172  01-01-80 00:00   .hg_archival.txt
         10  01-01-80 00:00   .hgsub
         45  01-01-80 00:00   .hgsubstate
          3  01-01-80 00:00   x.txt
         10  01-01-80 00:00   foo/.hgsub
         45  01-01-80 00:00   foo/.hgsubstate
          9  01-01-80 00:00   foo/y.txt
          9  01-01-80 00:00   foo/bar/z.txt
   --------                   -------
        303                   8 files

(2 digit year, shorter -- separators and closer columns).  We don't care about
any of that, so ignore it.
2015-06-17 16:45:25 -04:00
Pierre-Yves David
5446aa78a9 progress: move all logic altering the ui object logic in mercurial.ui
The ui object can take care of its progress object logic by itself.

test-subrepo-recursion is modified because it is a bit sensitive to the "no
progress bar" default. It will become unnecessary in the next step when
progress will be on by default in core.
2015-06-07 17:50:56 -07:00
Matt Harbison
6db3dc7daf test-subrepo-recursion: restore globs for Windows 2015-06-09 23:40:13 -04:00
Augie Fackler
c0281fcfaa test-subrepo-recursion.t: fix progress output on no-hardlink systems 2015-06-09 12:57:57 -04:00
Pierre-Yves David
77d8baf9e3 progress: stop double-wrapping of ui class
We were wrapping the ui class again and again (uisetup, reposetup,
subrepo setup, remote repo setup, etc). We now avoid that. This has
impact on tests that were double-printing data because of this.
2015-06-07 18:11:23 -07:00
Pierre-Yves David
6a8561c0f3 test-subrepo-recursion: glob out all the date listed by unzip -l
This date output is unstable (01-01-1980 vs 1980-01-01). As the test is not
about the modification date, we glob the data out.

Caught by buildbot.
2015-05-07 14:57:02 -07:00
Matt Harbison
9fe8bb732e archive: drop the leading '.' path component from the prefix (issue4634)
Unix utilities like tar will happily prefix the files it packs with './', but
annoyingly, Windows Explorer will not show these packed files when it opens the
archive.  Since there doesn't seem to be a point in including './' in the path
names, just drop it.  The default 'hg archive' prefix is the basename of the
archive, so specifying '.' allows for that default to be disabled completely.
2015-05-05 20:52:38 -04:00
Matt Harbison
7ae29b6407 archive: always use portable path component separators with subrepos
The previous behavior when archiving a subrepo 's' on Windows was to internally
name the file under it 's\file', due to the use of vfs.reljoin().  When printing
the file list from the archive on Windows or Linux, the file was named
's\\file'.  The archive extracted OK on Windows, but if the archive was brought
to a Linux system, it created a file named 's\file' instead of a directory 's'
containing 'file'.

*.zip format achives seemed not to have the problem, but this was definitely an
issue with *.tgz archives.

Largefiles actually got this right, but a test is added to keep this from
regressing.  The subrepo-deep-nested-change.t test was repurposed to archive to
a file, since there are several subsequent tests that archive to a directory.
The output change is losing the filesystem prefix '../archive_lf' and not
listing the directories 'sub1' and 'sub1/sub2'.
2015-05-04 22:33:29 -04:00
Augie Fackler
a5924b3112 test-subrepo-recursion: fix output on non-hardlink systems
There's a slight bug present where a topic doesn't get closed when it should.
This isn't a regression, so I've made a note in the test file.
2015-04-03 18:19:24 -04:00
Augie Fackler
4330579238 test-subrepo-recursion: set progress.changedelay really high
This avoids subtopics from showing up, which were introduced by my recent
change that added progress bars to hardlink clones in some cases.
2015-04-03 23:12:21 -04:00
FUJIWARA Katsunori
d9071e6959 subrepo: add dirtyreason to centralize composing dirty reason message
This patch newly adds "dirtyreason()" to centralize composing dirty
reason message like "uncommitted changes in subrepository 'xxxx'".

There are 3 similar messages below, and this patch is a part of
preparations for unifying them into (1), too.

  1. uncommitted changes in subrepository 'XXXX'
  2. uncommitted changes in subrepository XXXX
  3. uncommitted changes in subrepo XXXX

This patch chooses adding new method "dirtyreason()" instead of making
"dirty()" return "reason string", because:

  - some of existing "dirty()" implementation is too complicated to do
    so simply, and

  - ill-mannered 3rd party subrepo classes, of which "dirty()" doesn't
    return "reason string", cause meaningless message (even though it
    is rare case)
2015-03-25 13:55:32 +09:00
Matt Harbison
1b58f58b45 revert: evaluate subrepos to revert against the working directory
Reverting to a revision where the subrepo didn't exist will now abort, and
matching subrepos against the working directory is consistent with how filesets
are evaluated since dd1c701aad4d.
2015-03-25 22:20:44 -04:00
Augie Fackler
dc9632b47a clone: add progress support to hardlink clones (issue3059) 2015-03-13 18:28:11 -04:00
Matt Harbison
d92b702a94 largefiles: revert to lfilesrepo.status() being an unfiltered method
This effectively reverts 9fc565fa1621, which caused some normal file copies to
not be displayed as copies.  Other normal file copies could be displayed- the
exact reason isn't clear.  This also adds two tests that were failing prior to
this backout, so that this can be sorted out next cycle.

The difference between copy cases that worked and those that didn't seemed to be
in copies.pathcopies().  When largefiles isn't enabled for the changed test, or
lfstatus is not set in the commands.status() override, 'y.ancestor(x) == x'.
That wasn't true otherwise, which fell through to the _chain() method.  In this
case, the copy is removed in the criss cross loop.

'y.ancestor(x)' returns a context.changectx type, while 'x' is a lfilesctx type
in the failing case.  I tried adding the ancestor method to the lfilesctx class
to change the type of the ancestor context, however the context when printed as
a string then gains a '+'.  This points to it being a context.committablectx,
which clearly isn't correct for an ancestor.  Possibly the problem is the
lfilesctx needs to subclass context.committablectx in some cases, but
context.changectx in others, within the same invocation?  I'm not sure how to
pull that off, and backing out this change is safer during the freeze.

As to the status changing when a path is specified, I haven't looked into it
yet.
2015-01-25 22:55:10 -05:00
Angel Ezquerra
586f53ce9d subrepo: append subrepo path to subrepo error messages
This change appends the subrepo path to subrepo errors. That is, when there
is an error performing an operation a subrepo, rather than displaying a message
such as:

pushing subrepo MYSUBREPO to PATH
searching for changes
abort: push creates new remote head HEADHASH!
hint: did you forget to merge? use push -f to force

mercurial will show:

pushing subrepo MYSUBREPO to PATH
searching for changes
abort: push creates new remote head HEADHASH! (in subrepo MYSUBREPO)
hint: did you forget to merge? use push -f to force

The rationale for this change is that the current error messages make it hard
for TortoiseHg (and similar tools) to tell the user which subrepo caused the
push failure.

The "(in subrepo MYSUBREPO)" message has been added to those subrepo methods
were it made sense (by using a decorator). We avoid appending "(in subrepo XXX)"
multiple times when subrepos are nexted by throwing a "SubrepoAbort" exception
after the extra message is appended. The decorator will then "ignore" (i.e. just
re-raise) the exception and never add the message again.

A small drawback of this method is that part of the exception trace is lost when
the exception is catched and re-raised by the annotatesubrepoerror decorator.

Also, because the state() function already printed the subrepo path when it
threw an error, that error has been changed to avoid duplicating the subrepo
path in the error message.

Note that I have also updated several subrepo related tests to reflect these
changes.
2012-12-13 23:37:53 +01:00
Mads Kiilerich
e0c0cf576f test-subrepo-recursion.t: re-introduce glob to handle \ slashes on Windows
Regression was introduced in 413c3f722ffd.

Resolved by using the fine line noise '\r (no-eol) (glob) (esc)'.
2012-10-14 18:30:47 +02:00
Mads Kiilerich
13cd04eefb tests: drop filtercr.py and use the very explicit '\r (no-eol) (esc)' markup 2012-10-10 01:37:54 +02:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Mads Kiilerich
d94d866bcb tests: add missing accept of native pathname separator 2012-04-28 01:55:39 +02:00
Thomas Arendsen Hein
a076708e7b merge with stable 2012-04-03 21:02:00 +02:00
Thomas Arendsen Hein
21bb7c4cdc tests: make tests work if directory contains special characters
With this quoting tests will work e.g. in "/tmp/foo bar/mercurial/".
2012-04-03 19:06:35 +02:00
FUJIWARA Katsunori
1b096f8579 forget: show warning messages for forgetting in subrepo correctly
in 'cmdutil.forget()':

   for f in match.files():
       if match.exact(f) or not explicitonly:
           ....

is equal to:

   for f in match.files():
       if True:
           ....

because 'f' from 'match.files()' should 'match.exact(f)':

    - 'match.files()' returns 'self._files'
    - 'match.exact(f)' examines 'f in self._fmap',
    - 'self._fmap' of match is 'set(self._files)'

then, 'explicitonly' wants to suppress warning messges, if it is true
(= 'cmdutil.forget()' is invoked from 'subrepo.forget()').

so, current code should be fixed as:

    if not explicitonly:
        for f in match.files():
           ....
2012-02-06 14:37:49 +09:00
Matt Mackall
6715adc25e merge with stable 2012-02-06 15:22:43 -06:00
Matt Mackall
a17b10a14b subrepo: rewrite handling of subrepo state at commit (issue2403)
When the contents of .hgsubstate are stale (either because they've
manually been tweaked or partial updates have confused it), we get
confused about whether it actually needs committing.

So instead, we actively consult the parent's substate and compare it
the actual current state when deciding whether it needs committing.

Side effect: lots of "committing subrepo" messages that didn't
correspond with real commits disappear.

This change is fairly invasive for a fairly obscure condition, so it's
kept on the default branch.
2012-02-06 15:10:01 -06:00
David M. Carr
560a2fff89 forget: fix subrepo recursion for explicit path handling
When support for handling explicit paths in subrepos was added to the forget
command (155b89136ae7), subrepo recursion wasn't taken into account.  This
change fixes that by pulling the majority of the logic of commands.forget into
cmdutil.forget, which can then be called from both there and subrepo.forget.
2012-01-17 19:10:59 -05:00
David M. Carr
375e0ca3cf add: fix subrepo recursion for explicit path handling
When support for handling explicit paths in subrepos was added to the add
command (825c4cefde4b), subrepo recursion wasn't taken into account.  This
change adds an explicitonly argument to cmdutil.add to allow controlling which
levels of recursion should include only explicit paths versus all matched
paths.
2012-01-17 19:10:58 -05:00
David M. Carr
d83135c3ee tests: add subrepo recursion tests for add/forget with explicit paths
When support for handling add/forget of explicit paths within subrepos was
added (825c4cefde4b/155b89136ae7), nested subrepos weren't handled properly.
This change adds test coverage to expose the broken behavior, which will be
fixed in later patches.
2012-01-17 19:10:54 -05:00
Mads Kiilerich
9c95d62a3d tests: add missing '(glob)'s to match '\' in paths in test output on windows 2011-11-16 03:45:14 +01:00
Mads Kiilerich
8c22a0ec28 tests: make (glob) on windows accept \ instead of /
Globbing is usually used for filenames, so on windows it is reasonable and very
convenient that glob patterns accepts '\' or '/' when the pattern specifies
'/'.
2011-11-07 03:25:10 +01:00
Martin Geisler
acfa971cf1 subrepos: abort commit by default if a subrepo is dirty (BC)
This changeset flips the default value of ui.commitsubrepos setting
from True to False and adds a --subrepos flag to commit.

The commit, status, and diff commands behave like this with regard to
recusion and the ui.commitsubrepos setting:

          | recurses      | recurses
          | by default    | with --subrepos
  --------+---------------+----------------
  commit: | commitsubrepo | True
  status: | False         | True
  diff:   | False         | True

By changing the default from True to False, the table becomes
consistent in the two columns:

* without --subrepos on the command line, commit will abort if a
  subrepo is dirty and status/diff wont show changes inside subrepos.

* with --subrepos, all three commands will recurse.

A --subrepos flag on the command line overrides the config settin.g
2011-10-21 00:33:08 +02:00
Martin Geisler
c49aaff90e subrepo: abort in hgsubrepo._get if the destination is obstructed
Before, we deleted foo when we determined that there were zero
changesets in the foo subrepo. Any files in foo was deleted too. We
now delete foo/.hg instead, and the normal checks in hg.clone will
then abort if there are untracked files in foo.
2011-10-17 18:01:38 +02:00
Martin Geisler
ebc547d4c7 subrepo: pull revisions on demand when archiving hg subrepos
Before, running 'hg archive -S' could result in

 abort: unknown revision '65903cebad86f1a84bd4f1134f62fa7dcb7a1c98'!

if a subrepo was missing completely or had missing changesets. Now,
the missing changesets will be pulled or cloned as appropriate.

This make Mercurial subrepos match Git subrepos which already took
care to fetch any missing commits before starting the archive.
2011-10-17 16:45:19 +02:00
Martin Geisler
efe9b04aef subrepo: create subrepos using clone instead of pull
Subrepositories used to be created empty and then filled with data
using pull. This is wasteful when you do a clone from a local source
since it means that no hardlinks are created for the subrepos.

This patch make the hgsubrepo._get method check for an empty subrepo
and in that case do a clone instead of a pull. This brings in the same
data as before, but creates hardlinks when possible.
2011-05-09 17:15:44 +02:00
Martin Geisler
6090144a5b merge with stable 2011-02-04 09:17:07 +01:00
trbs
2b860c833d subrepo: fix pruning of subrepo filenames in dirstate (issue2619) 2011-02-04 09:05:23 +01:00
Augie Fackler
5de2d97578 progress using tests: disable time estimates to avoid flakiness 2010-12-15 10:55:14 -06:00