Commit Graph

4516 Commits

Author SHA1 Message Date
Mads Kiilerich
67c67bcdbe mq: upgrade non-plain patches to HG format when setting parent in patchheader
Parent will now always be updated or added when qrefreshing HG patches. Plain
patches will not be changed, but patches that neither are plain nor HG will be
upgraded to HG patches on first refresh.
2014-09-20 17:06:57 +02:00
Mads Kiilerich
a82df81b22 mq: make patchheader .plainmode more reliable
Instead of having to make extra checks whenever we use .plainmode, let the
initial value consider the actual patch header content.
2014-09-20 17:06:56 +02:00
Martin von Zweigbergk
f89da734dc largefiles: simplify iteration over standins
Instead of iterating over all files in the context and ignoring those
that are not standins, pass a standin-matcher to the context and
iterate over only the files matching.

Apart from making the intent clearer, this implementation will also
benefit from any future optimizations done to the manifest walking
code.
2014-09-16 23:10:39 -07:00
Martin von Zweigbergk
aebcb29ce7 largefiles: avoid using 'lfiles' variable for two purposes
The variable 'lfiles' is first used for a set of the names of all the
large files. It is then overwritten with a tuple like the ones
returned from status(). To reduce confusion, let's create a separate
variable for the second use.
2014-09-16 22:50:38 -07:00
Martin von Zweigbergk
292e59117b largefiles: remove unnecessary clearing of status fields
At the end of lfilesrepo.status(), we clear the lists of unknown,
ignored and clean files, depending on the values of 'listunknown'
etc. The lists originate from other calls to status(), and it is only
'clean' that may get updated after the calls. Let's remove the need to
clear any of the lists by explicitly only adding to 'clean' when
'listclean' is true.
2014-09-22 13:05:36 -07:00
Mads Kiilerich
3057cb8243 mq: simplify patchheader handling of the empty line before the diff
Don't try to append empty lines to HG patch headers - instead, add them in str
method.

This minor change removes some apparently redundant code and makes the code
more robust.
2014-09-24 01:39:25 +02:00
Mads Kiilerich
600dadebda mq: write '# Parent ' lines with two spaces like export does (BC)
This aligns "Parent" node IDs with "Node ID" node IDs.
2014-09-24 01:36:44 +02:00
Mads Kiilerich
3ed8837146 mq: write headers for new HG patches in the same order as export (BC) 2014-09-20 17:06:56 +02:00
Mads Kiilerich
8c41a3576b mq: correctly make an empty line after description in new patches
There would in some cases be an empty line between headers and the description -
that does not seem right.

There should also be an empty line between description and diff - but that was
missing.

These two mistakes would sometimes make it up for each other so we fix both at
once to just show the improvement.

Instead of writing an extra newline when writing a header line, write an extra
line when it not is written as a part of the description but is necessary
anyway.
2014-09-20 17:06:56 +02:00
Martin von Zweigbergk
51a0933f38 largefiles: extract 'orig' method in reposetup.status 2014-09-16 14:51:56 -07:00
Martin von Zweigbergk
3121cae56f largefiles: extract 'orig' method in lfilesctx.filectx 2014-09-16 14:51:25 -07:00
Martin von Zweigbergk
03aa948230 largefiles: extract 'orig' method in lfilesmanifestdict.__contains__ 2014-09-16 14:50:38 -07:00
Martin von Zweigbergk
a0a60c4479 largefiles: reduce indentation by dropping 'else' block after 'return' 2014-09-16 14:40:25 -07:00
Martin von Zweigbergk
7eebfa3be1 largefiles: remove dead assignment left over from change 857b0706f1e5 2014-09-16 11:35:13 -07:00
Siddharth Agarwal
f149aa54b6 convert: change default for git rename detection to 50%
This default mirrors the default for 'git diff'. Other commands have slightly
different defaults -- for example, the move/copy detection for 'git blame'
assumes that a hunk is moved if more than 40 alphanumeric characters are the
same, or copied if more than 20 alphanumeric characters are the same. 50% seems
to be the most common default, though.
2014-09-23 14:45:23 -07:00
Siddharth Agarwal
f28296d4ee convert: simplify git.similarity parsing 2014-09-23 14:40:32 -07:00
Siddharth Agarwal
c1d6e28494 convert: add support to find git copies from all files in the working copy
I couldn't think of a better name for this option, so I stole the Git one in
the hope that anyone converting a Git repo knows what it means.
2014-09-12 12:28:30 -07:00
Siddharth Agarwal
476da59ea2 convert: add support to detect git renames and copies
Git is fairly unique among VCSes in that it doesn't record copies and renames,
instead choosing to detect them on the fly. Since Mercurial expects copies and
renames to be recorded, it can be valuable to preserve this history while
converting a Git repository to Mercurial. This patch adds a new convert option,
called 'convert.git.similarity', which determines how similar files must be to
be treated as renames or copies.
2014-09-12 11:23:26 -07:00
Siddharth Agarwal
cff27af0c6 convert: for git, factor out code to add entries to a separate function
We're going to call this for multiple files in one iteration in upcoming
patches.
2014-09-11 23:57:49 -07:00
Siddharth Agarwal
02fa27546c convert: for git's getchanges, always split entry line into components
We always need to know whether the entry is a rename or copy, so split it up
unconditionally.
2014-09-11 23:37:47 -07:00
Siddharth Agarwal
1ab3d98437 convert: for git's getchanges, use explicit index for iteration
Upcoming patches will add support for copies and renames, for which we'll need
to access multiple lines of the difftree output at once.
2014-09-11 23:35:19 -07:00
Siddharth Agarwal
1a1fc7e9e2 convert: add initial docs for git sources
Upcoming patches will add config options for git sources. This patch adds a
place to document them.
2014-09-12 10:17:56 -07:00
Jordi Gutiérrez Hermoso
71fd49d081 color: document that changeset phases have labels
It's very useful to be able to colourise csets according to their
phases. There was no indication anywhere in the docs that this is
possible.

We use e.g. `changeset.secret = ` instead of `changeset.secret
='none'`, because otherwise this is a BC: it would nullify the effects
given to log.changeset label that usually surrounds the
changeset.{phase} labels. Specifying the label without any effect
instead of 'none' is a true no-op change and purely documentation.
2014-08-24 17:27:28 -04:00
Matt Mackall
ef96dff15e color: change the debug output format
Before, the format was

 label(labeled text)  # single label
 [label1 label2](labeled text) # multiple

Now, it's

 [labels|labeled text]

..which should make things a bit more clear.
2014-09-19 12:51:15 -05:00
Jordi Gutiérrez Hermoso
3818f62593 color: enable debug option to show labels
This is a debug option for showing labels. This can be helpful for
knowing which labels are available for colouring or to see the output
when defining your own templates. A couple of tests are included.
2014-08-24 17:40:27 -04:00
Jordi Gutiérrez Hermoso
d23bdb740a color: document that labels are used for colorizing text
It is a deeply hidden secret that it's possible to colorise so many
things with so many different labels. This is an attempt to document
this. The text is a bit long, but it seems as short as can be while
documenting everything. Perhaps it should be hidden under a --verbose
option.
2014-08-24 17:35:36 -04:00
Matt Mackall
95b134cbe5 merge with stable 2014-09-16 14:49:56 -05:00
FUJIWARA Katsunori
d8d8f99761 mq: examine "pushable" of already applied patch correctly
Before this patch, "hg qselect" with --pop/--reapply may pop patches
unexpectedly, even when all of patches applied before "qselect" are
still pushable.

Strictly speaking about the condition of this issue:

  - before "qselect"
    - there are N applied patches
    - the index of the guarded patch X in the series is less than N

  - after "qselect"
    - X is still guarded, and
    - all of applied patched are still pushable

In the case above, "hg qselect" should keep current status, but it
actually tries to pop patches because of X.

The index in "the series" should be used to examine "pushable" of a
patch by "mq.pushablek()", but the index in "applied patches" is used,
and this may cause unexpected examination of guarded patch.

To examine "pushable" of already applied patch correctly, this patch
uses "mq.applied[i].name": "pushable" is the function introduced by
the previous patch, and it returns "mq.pushable(mq.applied[i].name)[0]".
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
396a8e0831 mq: pop correct patches when changing pushable-ness of already applied ones
Before this patch, "hg qselect" with --pop/--reapply may pop incorrect
patches, because the index in "applied patches" is used to pop patches
by "mq.pop()", even though the index in "the series" should be used.

For example, when the already applied patch becomes guarded and it
follows the already guarded (= not yet applied) one, "hg qselect" is
aborted, because it tries to pop to guarded one.

This patch uses "mq.applied[i - 1].name" to pop to the patch, of which
the index in the "applied ones" is "i - 1".
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
3efcc894d8 mq: use "mq.applied[i].name" instead of "mq.appliedname(i)" for safety
Before this patch, "hg qselect --reapply" is aborted when "--verbose"
is specified, because "mq.appliedname()" returns "INDEX PATCHNAME"
instead of "PATCHNAME" in such case and "mq.push" can't accept the
former as the name of patch.

This patch uses "mq.applied[i].name" instead of "mq.appliedname(i)" as
the name of the patch to be pushed for safety.

Now, there is no code path using "mq.appliedname()", and it should be
removed to prevent developers from using it in the wrong way like this
issue.
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
5e22c34bd1 mq: report correct numbers for changing "number of guarded, applied patches"
Before this patch, "hg qselect" may report incorrect numbers for
"number of guarded, applied patches has changed", because it examines
"pushable" of patches by the index not in "the series" but in "applied
patches", even though "mq.pushable()" expects the former.

To report correct numbers for changing "number of guarded, applied
patches", this patch uses the name of applied patch to examine
pushable-ness of it.

This patch also changes the result of existing "hg qselect" tests,
because they doesn't change pushable-ness of already applied patches.

This patch assumes that "hg qselect" focuses on changing pushable-ness
only of already applied patches, because:

  - the report message uses not "previous" (in the series) but
    "applied"

  - the logic to pop patches for --pop/--reapply examines
    pushable-ness only of already applied ones (in fact, there are
    some incorrect code paths)
2014-09-12 02:29:19 +09:00
Siddharth Agarwal
ca3e00a8e3 histedit: abort gracefully on --continue/--abort with no state
Previously we'd print an ugly message saying that the histedit-state file
doesn't exist in the repo.
2014-09-03 20:42:51 +02:00
Siddharth Agarwal
6e2ab4d61f largefiles: don't override matchandpats for always matchers (issue4334)
This makes hg log --follow --patch work, since in cmdutil._makelogrevset we
use the non-follow matcher for hg log --follow --patch with no file arguments.
2014-08-13 15:51:33 -07:00
Siddharth Agarwal
c70d49625f largefiles: in overridelog, use non-lf matcher for patch generation (issue4334)
This has actually been broken since at least Mercurial 2.8 -- hg log --patch
with largefiles only used to work when no largefiles existed. Rev 658ce4a0a0a9
exposed this bug for all cases.
2014-08-13 15:18:41 -07:00
Siddharth Agarwal
dcc2ebb6cf largefiles: drop setting lfstatus in overridelog (issue4334)
lfstatus should only be True for operations where we want standins to be
printed out. We explicitly do not want that for historical operations like log.
Other historical operations like hg diff -r A -r B don't print out standins
either.

This is required to fix issue4334, but doesn't fix anything by itself. That's
why there aren't any tests accompanying this patch.
2014-08-13 15:13:50 -07:00
Martin von Zweigbergk
69e9a354a2 histedit: preserve initial author on fold (issue4296)
When the authorship of the changeset folded in does not match that of
the base changeset, we currently use the configured ui.username
instead. This is especially surprising when the user is not the author
of either of the changesets. In such cases, the resulting authorship
(the user's) is clearly incorrect. Even when the user is folding in a
patch they authored themselves, it's not clear whether they should
take over the authorship. Let's instead keep it simple and always
preserve the base changeset's authorship. This is also how
"git rebase -i" handles folding/squashing.
2014-08-13 11:50:13 -07:00
Sean Farley
822e69ce3a color: pass on key error for win32 (issue4298)
This is a quick fix for some consoles on windows (consoles that are not mingw
based) so that the debugcolor command doesn't throw a KeyError when effects
aren't supported (e.g. italic).
2014-08-01 13:09:06 -05:00
Matt Mackall
488f376f73 qimport: record imported revs incrementally (issue3874)
When an import fails, this doesn't lose the state for the earlier
revisions.
2014-07-31 16:32:12 -05:00
FUJIWARA Katsunori
413d1be801 convert: fix argument mismatch at formatting the abort message
This patch fixes argument mismatch at formatting the abort message,
introduced by dcf325a55d85: the last '%s' doesn't have corresponded
argument.

This patch uses "unexpected size" in the abort message, to distinguish
the reason of failure from "unexpected type" failure checked in the
prior code path below:

        if info[1] != type:
            raise util.Abort(_('cannot read %r object at %s') % (type, rev))
2014-08-01 02:14:24 +09:00
FUJIWARA Katsunori
5f213b8584 doc: unify help text for "--edit" option
This patch changes help text for "--edit" option of commands below:

  - fetch
  - qnew
  - qrefresh
  - qfold
  - commit
  - tag

This unification reduces translation cost, too.

This patch chooses not "further edit commit message already specified"
(of "hg commit") but "invoke editor on commit messages" as unified
help text for "--edit" option, because the latter is much older than
the former.
2014-07-30 00:14:52 +09:00
FUJIWARA Katsunori
3c5c28c967 doc: unify help text for "--message" option
This patch changes help text for "--message" option of commands below
for unification.

  - sign (of gpg)
  - tag

This unification reduces translation cost, too.

This patch doesn't change the description for "--message" of "hg
rebase" below, because this should contain "collapse" word to explain
its purpose (only for "--collapse") clearly.

    use text as collapse commit message
2014-07-30 00:13:59 +09:00
Augie Fackler
73aafc176d histedit: respect revsetalias entries (issue4311)
We now expand user-provided revsets before using repo.revs() to locate
the root(s) of the user-specified set.
2014-07-28 19:20:13 -04:00
FUJIWARA Katsunori
8c6b77e441 largefiles: use "normallookup" on "lfdirstate" while reverting
Before this patch, largefiles gotten from revisions other than the
parent of the working directory at "hg revert" become "clean"
unexpectedly in steps below:

    1. "repo.status()" is invoked (for status check before reverting)
      1-1 "dirstate" entry for standinfile SF is "normal"-ed
     (1-2 "lfdirstate" entry of largefile LF (for SF) is "normal"-ed)

    2. "cmdutil.revert()" is invoked
      2-1 standinfile SF is updated in the working directory
      2-2 "dirstate" entry for SF is NOT updated

    3. "lfcommands.updatelfiles()" is invoked (by "overrides.overriderevert()")
      3-1 largefile LF (for SF) is updated in the working directory
      3-2 "dirstate" returns "n" and valid timestamp for SF (by 1-1 and 2-2)
      3-3 "lfdirstate" entry for LF is "normal"-ed
      3-4 "lfdirstate" is written into ".hg/largefiles/dirstate", and
          timestamp of LF is stored into "lfdirstate" file (by 3-3)
          (ASSUMPTION: timestamp of LF differs from one of "lfdirstate" file)

Then, "hs status" treats LF as "clean", even though LF is updated by
"other" revision (by 3-1), because "lfilesrepo.status()" always treats
"normal"-ed files (by 3-3 and 3-4) as "clean".

When largefiles are reverted, they should be "normallookup"-ed
forcibly.

This patch uses "normallookup" on "lfdirstate" while reverting, by
passing "True" to newly added argument "normallookup".

Forcible "normallookup"-ing is not so expensive, because list of
target largefiles is explicitly specified in this case.

This patch uses "[debug] dirstate.delaywrite" feature in the test, to
ensure that timestamp of the largefile gotten from "other" revision is
stored into ".hg/largefiles/dirstate" (for ASSUMPTION at 3-4)
2014-07-23 00:10:24 +09:00
FUJIWARA Katsunori
f5a07da3f0 largefiles: invoke "normallookup" on "lfdirstate" for merged files
Before this patch, largefiles gotten from "other" revision (with
conflict) at "hg merge" become "clean" unexpectedly in steps below:

    1. "repo.status()" is invoked (for status check before merging)
      1-1 "dirstate" entry for standinfile SF is "normal"-ed
      1-2 "lfdirstate" entry of largefile LF (for SF) is "normal"-ed

    2. "merge.update()" is invoked
      2-1 SF is updated in the working directory
          (ASSUMPTION: user choice "other" at conflict)
      2-2 "dirstate" entry for SF is "merge"-ed

    3. "lfcommands.updatelfiles()" is invoked (by "overrides.hgmerge()")
      3-1 largefile LF (for SF) is updated in the working directory
      3-2 "dirstate" returns "m" for SF (by 2-2)
      3-3 "lfdirstate" entry for LF is left as it is
      3-4 "lfdirstate" is written into ".hg/largefiles/dirstate", and
          timestamp of LF is stored into "lfdirstate" file (by 1-2)
          (ASSUMPTION: timestamp of LF differs from one of "lfdirstate" file)

Then, "hs status" treats LF as "clean", even though LF is updated by
"other" revision (by 3-1), because "lfilesrepo.status()" always treats
"normal"-ed files (by 1-2 and 3-4) as "clean".

When state of standinfile in "dirstate" is "m", largefile should be
"normallookup"-ed.

This patch invokes "normallookup" on "lfdirstate" for merged files.

This patch uses "[debug] dirstate.delaywrite" feature in the test, to
ensure that timestamp of the largefile gotten from "other" revision is
stored into ".hg/largefiles/dirstate". (for ASSUMPTION at 3-4)
2014-07-23 00:10:24 +09:00
FUJIWARA Katsunori
c24b717f3e largefiles: use "normallookup", if "mtime" of standin is unset
Before this patch, largefiles gotten from "other" revision (without
conflict) at "hg merge" become "clean" unexpectedly in steps below:

    1. "merge.update()" is invoked
      1-1 standinfile SF is updated in the working directory
      1-2 "dirstate" entry for SF is "normallookup"-ed

    2. "lfcommands.updatelfiles()" is invoked (by "overrides.hgmerge()")
      2-1 largefile LF (for SF) is updated in the working directory
      2-2 "dirstate" returns "n" for SF (by 1-2)
      2-3 "lfdirstate" entry for LF is "normal"-ed
      2-4 "lfdirstate" is written into ".hg/largefiles/dirstate", and
          timestamp of LF is stored into "lfdirstate" file
          (ASSUMPTION: timestamp of LF differs from one of "lfdirstate" file)

Then, "hs status" treats LF as "clean", even though LF is updated by
"other" revision (by 2-1), because "lfilesrepo.status()" always treats
"normal"-ed files (by 2-3 and 2-4) as "clean".

When timestamp is not set (= negative value) for standinfile in
"dirstate", largefile should be "normallookup"-ed regardless of
rebasing or not, because "n" state in "dirstate" doesn't ensure
"clean"-ness of a standinfile at that time.

This patch uses "normallookup" instead of "normal", if "mtime" of
standin is unset

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, "lfdirstate" should
be updated with "dirstate" simultaneously while "merge.update"
execution: maybe by hooking "recordupdates"

It is also why this patch (temporarily) uses internal field "_map" of
"dirstate" directly.

This patch uses "[debug] dirstate.delaywrite" feature in the test, to
ensure that timestamp of the largefile gotten from "other" revision is
stored into ".hg/largefiles/dirstate". (for ASSUMPTION at 2-4)

This patch newly adds "test-largefiles-update.t", to avoid increasing
cost to run other tests for largefiles by subsequent patches
(especially, "[debug] dirstate.delaywrite" causes so).
2014-07-22 23:59:34 +09:00
Matt Harbison
cbf609dee6 largefiles: avoid unnecessary creation of .hg/largefiles when opening lfdirstate
Previously, the directory '.hg/largefiles' would always be created if it didn't
exist when the lfdirstate was opened.  If there were no standin files, no
dirstate file would be created in the directory.  The end result was that
enabling the largefiles extension globally, but not explicitly adding a
largefile would result in the repository eventually sprouting this directory.

Creation of this directory effectively changes readonly operations like summary
and status into operations that require write access.  Without write access,
commands that would succeed without the extension loaded would abort with a
surprising error when the extension is loaded, but not actively used:

  $ hg sum -R /tmp/thg --config extensions.largefiles=
  parent: 16541:00dc703d5aed
   repowidget: specify incoming bundle by plain file path to avoid url parsing
  branch: default
  abort: Permission denied: '/tmp/thg/.hg/largefiles'


This change is simpler than changing the callers of openlfdirstate() to use the
'create' parameter that was introduced in 74522122b97d, and probably how that
should have been implemented in the first place.
2014-07-17 20:17:17 -04:00
Augie Fackler
2ecee11b67 histedit: check mutability of contexts correctly
The right way to check if a context is mutable is to call .mutable(),
not to compare .phase() with public.
2014-08-19 14:33:01 -04:00
Augie Fackler
88def43f03 convert: enable deterministic conversion progress bar for svn
This produces slightly bad results when branches are in play, but
overall I think it's probably worthwhile. We might be able to do
better with branches somehow, but I haven't given it any thought.
2014-09-10 10:52:00 -04:00
Augie Fackler
8997a30abc convert: enable deterministic conversion progress bar for git 2014-09-10 10:51:46 -04:00
Augie Fackler
9f56b0fdbf convert: add support for deterministic progress bar on scanning phase
This makes it possible to estimate how long the "scanning source"
phase will take, if the specified source repo type supports a quick
"how many changes" check.
2014-05-26 11:53:12 -04:00