Commit Graph

22151 Commits

Author SHA1 Message Date
Pierre-Yves David
2be245bb0d obsolete: support for any known obsstore format when reading or writing
We can now read and write any known format. The list of known formats
currently has one element (0). The obsstore itself is not aware of
multiple formats yet and always uses format 0.
2014-08-25 16:16:01 +02:00
Pierre-Yves David
e891429fca obsolete: move _fm0encodeonemarker next to _fm0readmarkers 2014-08-25 16:09:18 +02:00
Pierre-Yves David
59d5970fe3 obsolete: rename _encodeonemarker to _fm0encodeonemarkers
This function encodes markers in version 0 of the format.
2014-08-25 16:43:23 +02:00
Pierre-Yves David
30503ced28 obsolete: extract the part of _readmarkers specific to format version 0
If we are to introduce new formats we need to be able call different
functions for different formats. Creating a function for format
version 0 is the first step.
2014-08-25 14:58:11 +02:00
Pierre-Yves David
104efe6c90 obsolete: rename all _fm to _fm0
This change is because these formats are used for version 0 of the
obsstore format. This is going to be useful in the future when we
introduce new versions of the format.
2014-08-25 14:56:15 +02:00
Pierre-Yves David
7cf82e8c6d obsolete: rename _fnodesize to _fmfnodesize
All variables involved in the obsstore format are prefixed with `_fm`.
`_fnodesize` was the exception. It is now back in line.

This is meaningful as we'll need to distinguish between multiple versions of the
obsstore format.
2014-08-25 14:52:51 +02:00
Pierre-Yves David
1ea986ffcd obsstore: have the mergemarkers method return the number of new markers
The mergemarkers function now returns the number of unknown markers in
the stream that have been added to the obsstore. This is similar to what
`obsstore.add` already does.

The method gains a docstring in the process.
2014-08-21 17:42:50 -07:00
Pierre-Yves David
c68039db71 test-bundle2: add obsolescence information to be exchanged
To introduce a bundle2 way to exchange obsolescence markers, we need to
have some information available to exchange. Introduce markers relevant
to changesets involved in the exchange. The new markers reference the
changesets as successor nodes of clowny (nonexistent) hashes so that
other than being exchanged they have no effect.

We introduce them in two waves as push is expected to be smart about the
number of markers it exchanges sooner than pull.
2014-08-21 17:36:05 -07:00
Matt Mackall
aaadb558ea merge with crew 2014-08-30 18:44:59 +02:00
Kevin Bullock
13972d0b4a bookmarks: refer to "the" active bookmark to clarify that there's only one
This is a follow-on to c6533daf7fc4 that just makes a slight clarification.
2014-08-30 15:13:02 +02:00
Siddharth Agarwal
65cbe9daf5 memctx: allow extensions to determine what filectxfn should do
Rev 2eef89bfd70d switched the contract for filectxfn from "raise IOError if
file is missing" to "return None if file is missing". Out of tree extensions
need to be updated for that, but for extensions interested in compatibility
with both Mercurial <= 3.1 and default, it is next to impossible to introspect
core Mercurial to figure out what to do.

This patch adds a field to memctx for extensions to use.
2014-08-30 05:29:38 -07:00
Gregory Szorc
94580f82da revsetbenchmark: add revset with lazyset subtraction
The added revset is used by obsolescence and currently results in
recursion in __contains__ between 2 lazysets. We should have
coverage of this revset.
2014-08-30 15:17:37 +02:00
Sune Foldager
f4c36b46b4 debugrevlog: add chainlen column to --dump output 2014-08-30 11:57:46 +02:00
Henrik Stuart
7b873ceea6 debugdag: stop wrongly sorting parents
The dag being dumped is not in a format that allows us to reconstruct the
original dag as the parent revisions are normalised.
2014-08-30 11:56:33 +02:00
Gregory Szorc
3cffe8cb84 obsolete: avoid slow, generic date parsing
Simple profiling of `hg log -r .` revealed ~18,000 calls to
mercurial.i18n.gettext() on the author's repository. The
culprit was 3 _() calls in util.parsedate() multiplied by
~6000 obsmarkers originating from the parsing of obsmarkers.

Changing the obsmarker code to parse the stored format of
dates instead of going through a generic path eliminates these
gettext() lookups and makes `hg log -r .` execute ~10% faster
on the author's repo. The performance gain is proportional to
the number of obsmarkers.

The author attempted to patch util.parsedate() to avoid the
gettext() lookups. However, that code is whacky and the author
is jet lagged, so the approach was not attempted.
2014-08-29 18:00:44 +02:00
Kevin Bullock
b5dafd9f52 build: don't use -s flag for which
`which -s` is a BSDism that doesn't exist on other versions of
`which`. That means that even on Mac OS X, `make osx` breaks if you have
another utils package installed (e.g. debianutils installed thru
fink). Redirect output to /dev/null instead.
2014-08-29 12:06:31 +02:00
Matt Mackall
fc6de0f1aa contrib: drop obsolete sample.hgrc
This was full of bad suggestions and is obsoleted by hg config --edit.
2014-08-29 17:15:49 +02:00
Matt Mackall
108b8a7b71 contrib: drop old convert-repo script
This has been obsolete since 2007.
2014-08-29 17:14:45 +02:00
Matt Mackall
3ce3f9064f merge with stable 2014-08-27 18:35:34 +02:00
FUJIWARA Katsunori
5c74f6bc14 import: show the warning message for failure of merging
Before this patch, no message is shown for failure of merging at "hg
import".

In such case, merging patch is imported as a normal revision silently,
and it may confuse users.

For simplicity, this patch recommends just using "--exact", even
though importing the merging patch itself is possible without it if:

  - the hash of the 1st parent in the patch is equal to one of the
    patch imported just before (or the parent of the working
    directory, for the 1st patch of the series), and

  - the hash of the 2nd parent in the patch is known in the local
    repository
2014-08-27 23:10:06 +09:00
Mads Kiilerich
bb5bc3c743 graft: fix collision detection with origin revisions that are missing
When grafting something with a matching origin, it would normally be skipped:
  skipping already grafted revision 123 (23 also has origin 12)

But after stripping a graft origin, graft could fail with a reference to the
origin that no longer exists:
  abort: unknown revision '5c095ad7e90f871700f02dd1fa5012cb4498a2d4'!

Instead, detect that the origin is unknown and skip it anyway, like:
  skipping already grafted revision 8 (2 also has unknown origin 5c095ad7e90f871700f02dd1fa5012cb4498a2d4)
2014-08-27 15:30:09 +02:00
Sean Farley
a5ff857520 log: use correct phase info for parent field (issue4347)
Previously, there was a copy / paste error with using the current changeset's
phase information. We now look up the parent context explicitly.

The line was too long so it is stored into a variable first.
2014-08-23 17:03:08 -05:00
Thomas De Schampheleire
1c23ea4c79 help: add pad function to template help
Commit 89145c35f76e introduced a pad function for use in templates, but did
not add the corresponding documentation to 'hg help templating'.
2014-08-25 15:10:09 +02:00
FUJIWARA Katsunori
baa869750d templater: enable alias predicates to be used in "revset()" function
Before this patch, predicates defined in "[revsetalias]" can't be used
in the query specified to template function "revset()", because:

  - "revset()" uses "localrepository.revs()" to get query result, but
  - "localrepository.revs()" passes "None" as "ui" to "revset.match()", then
  - "revset.match()" can't recognize any alias predicates

To enable alias predicates to be used in "revset()" function, this
patch invokes "revset.match()" directly with "repo.ui".

This patch doesn't make "localrepository.revs()" pass "self.ui" to
"revset.match()", because this may be intentional implementation to
prevent alias predicates from shadowing built-in ones and breaking
functions internally using "localrepository.revs()".

Even if it isn't intentional one, the check for shadowing should be
implemented (maybe on default branch) before fixing it for safety.
2014-08-23 21:23:02 +09:00
Mads Kiilerich
0df22182cc convert: introduce --full for converting all files
Convert will normally only process files that were changed in a source
revision, apply the filemap, and record it has a change in the target
repository. (If it ends up not really changing anything, nothing changes.)

That means that _if_ the filemap is changed before continuing an incremental
convert, the change will only kick in when the files it affects are modified in
a source revision and thus processed.

With --full, convert will make a full conversion every time and process
all files in the source repo and remove target repo files that shouldn't be
there. Filemap changes will thus kick in on the first converted revision, no
matter what is changed.

This flag should in most cases not make any difference but will make convert
significantly slower.

Other names has been considered for this feature, such as "resync", "sync",
"checkunmodified", "all" or "allfiles", but I found that they were less obvious
and required more explanation than "full" and were harder to describe
consistently.
2014-08-26 22:03:32 +02:00
Mads Kiilerich
49ef1c4045 convert: refactor hg getchanges and caching 2014-08-26 22:03:32 +02:00
Mads Kiilerich
89154d8277 convert: refactor subversion getchanges and caching 2014-08-26 22:03:32 +02:00
Mads Kiilerich
667168e1ac convert: remove incorrect and unused handling of removed svn directories
Since it was introduced in 670e8681d92a, tidy_dirs has been comparing
the result of os.listdir with a string - which never can be true.
Convert apparently works anyway and there is no test coverage of it.

It also seems like it could make a bigger difference on older svn versions but
is less relevant with more recent versions.

Instead of trying to fix the code, we take the low risk option and remove it.
2014-08-26 22:03:32 +02:00
Mads Kiilerich
4dd236da3f convert: use None value for missing files instead of overloading IOError
The internal API used IOError to indicate that a file should be marked as
removed.

There is some correlation between IOError (especially with ENOENT) and files
that should be removed, but using IOErrors to represent file removal internally
required some hacks.

Instead, use the value None to indicate that the file not is present.

Before, spurious IO errors could cause commits that silently removed files.
They will now be reported like all other IO errors so the root cause can be
fixed.
2014-08-26 22:03:32 +02:00
Matt Mackall
551e0eb2f6 merge with stable 2014-08-27 12:30:28 +02:00
Mads Kiilerich
e911f62a34 convert: p4: ignore purged files with p4d 2012.2 and later
Perforce has the concept of "+Sn" files where only the last revisions of the
file is stored. In p4d 2012.1 old purged revisions were not included in the
"manifest". With 2012.2 they started being included and convert's getfile
failed to recognize the "purged" flag and saw it as an empty file. That made
test-convert-p4-filetypes.t fail.

There is no point in storing an empty file as placeholder for a purged file so
we restore the old behaviour by checking the flag and letting getfile consider
purged files deleted.

(It is questionable whether it makes sense to convert not-yet-purged +S files
to mercurial ... but that is another question.)
2014-08-25 03:27:51 +02:00
Mads Kiilerich
9313be1c56 tests: fix p4 tests so they use separate ports and can be run in parallel 2014-08-25 03:27:51 +02:00
Mads Kiilerich
33397f4828 run-tests: report skipped tests as "skipped" - they might still be "relevant" 2014-08-26 22:03:30 +02:00
Yuya Nishihara
7bc5b972be ui: add brief comment why raw_input() needs dummy ' ' prompt string
Retrieved from 55a66b5d9114.

I was about to move ' ' to label(msg + ' ', 'ui.prompt') so that subclass can
distinguish prompt output from data.  But it was not that simple.
2014-08-24 12:35:53 +09:00
FUJIWARA Katsunori
75ce90a097 largefiles: remove redundant "updatelfiles" invocation in "lfilesrepo.commit"
After previous patches, largefiles in the working directory are
ensured to be updated before "repo.commit" invocation for automated
committing below:

  - by "overrides.mergeupdate" via "merge.update" for rebase
  - by "overrides.scmutilmarktouched" via "patch.patch" for transplant

This patch removes redundant "lfcommands.updatelfiles" invocation in
"Case 0" code path of "lfilesrepo.commit" for automated committing,
and revises detailed comment.
2014-08-24 23:47:26 +09:00
FUJIWARA Katsunori
b72ba540fe largefiles: update largefiles even if transplant is aborted by conflict
Before this patch, largefiles in the working directory aren't updated
correctly, if transplant is aborted by conflict. This prevents users
from viewing appropriate largefiles while resolving conflicts.

While transplant, largefiles in the working directory are updated only
at successful committing in the special code path of
"lfilesrepo.commit()".

To update largefiles even if transplant is aborted by conflict, this
patch wraps "scmutil.marktouched", which is invoked from "patch.patch"
with "files" list of added/modified/deleted files.

This patch invokes "updatelfiles" with:

  - "printmessage=False", to suppress "getting changed largefiles ..."
    messages while automated committing by transplant

  - "normallookup=True", because "patch.patch" doesn't update dirstate
    for modified files

    in such case, "normallookup=False" may cause marking modified
    largefiles as "clean" unexpectedly
2014-08-24 23:47:26 +09:00
FUJIWARA Katsunori
da42d55c85 largefiles: update largefiles even if rebase is aborted by conflict
Before this patch, largefiles in the working directory aren't updated
correctly, if rebase is aborted by conflict. This prevents users from
viewing appropriate largefiles while resolving conflicts.

While rebase, largefiles in the working directory are updated only at
successful committing in the special code path of
"lfilesrepo.commit()".

To update largefiles even if rebase is aborted by conflict, this patch
centralizes the logic of updating largefiles in the working directory
into the "mergeupdate" wrapping "merge.update".


This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, largefiles in the
working directory should be updated with other (normal) files
simultaneously while "merge.update" execution: maybe by hooking
"applyupdates".

"Action list based updating" introduced by hooking "applyupdates" will
also improve performance of updating, because it automatically
decreases target files to be checked.


Just after this patch, there are some improper things in "Case 0" code
path of "lfilesrepo.commit()":

  - "updatelfiles" invocation is redundant for rebase
  - detailed comment doesn't meet to rebase behavior

These will be resolved after the subsequent patch for transplant,
because this code path is shared with transplant.


Even though replacing "merge.update" in rebase extension by "hg.merge"
can also avoid this problem, this patch chooses centralizing the logic
into "mergeupdate", because:

  - "merge.update" invocation in rebase extension can't be directly
    replaced by "hg.merge", because:

    - rebase requires some extra arguments, which "hg.merge" doesn't
      take (e.g. "ancestor")

    - rebase doesn't require statistics information forcibly displayed
      in "hg.merge"

  - introducing "mergeupdate" can resolve also problem of some other
    code paths directly using "merge.update"

    largefiles in the working directory aren't updated regardless of
    the result of commands below, before this patch:

    - backout (for revisions other than the parent revision of the
      working directory without "--merge")

    - graft

    - histedit (for revisions other than the parent of the working
      directory


When "partial" is specified, "merge.update" doesn't update dirstate
entries for standins, even though standins themselves are updated.

In this case, "normallookup" should be used to mark largefiles as
"possibly dirty" forcibly, because applying "normal" on lfdirstate
treats them as "clean" unexpectedly.

This is reason why "normallookup=partial" is specified for
"lfcommands.updatelfiles".


This patch doesn't test "hg rebase --continue", because it doesn't
work correctly if largefiles in the working directory are modified
manually while resolving conflicts. This will be fixed in the next
step of refactoring for largefiles.

All changes of tests/*.t files other than test-largefiles-update.t in
this patch come from invoking "updatelfiles" not after but before
statistics output of "hg.update", "hg.clean" and "hg.merge".
2014-08-24 23:47:26 +09:00
FUJIWARA Katsunori
0c1f44d597 largefiles: move "updatestandin" invocation to "hg.updaterepo" wrapper
Code paths below expect "hg.updaterepo" (or "hg.update" using it) to
execute linear merging:

  - "update" in commands
  - "postincoming" in commands, used for:
    - "hg pull --update"
    - "hg unbundle --update"
  - "hgsubrepo.get" in subrepo

For linear merging with largefiles, standins should be updated
according to (possibly dirty) largefiles before "merge.update"
invocation to detect conflicts correctly.

Before this patch, only the "update" command can execute linear merging
correctly, because largefiles extension takes care of only it.

This patch moves "updatestandin" invocation from "overrideupdate" ("hg
update" wrapper) to "_hgupdaterepo" ("hg.updaterepo" wrapper) to
execute linear merging in "hg.updaterepo" correctly.

This is also a preparation to centralize the logic of updating
largefiles in the working directory into the function wrapping
"merge.update" in the subsequent patch.
2014-08-24 23:47:26 +09:00
FUJIWARA Katsunori
1e10153104 largefiles: unlink standins not known to the restored dirstate at rollback
Before this patch, standinds not known to the restored dirstate at
rollback still exist after rollback of the parent of the working
directory, and they become orphans unexpectedly.

This patch unlinks standins not known to the restored dirstate.

This patch saves names of standins matched against not
"repo.dirstate[f] == 'a'" but "repo.dirstate[f] != 'r'" before
rollback, because branch merging marks files newly added to
dirstate as not "a" but "n".

Such standins will also become orphan after rollback, because they are
not known to the restored dirstate.
2014-08-24 23:47:26 +09:00
FUJIWARA Katsunori
4bfc24bc88 largefiles: restore standins according to restored dirstate
Before this patch, standins are restored from the NEW parent of the
working directory at "hg rollback", and this causes:

  - standins removed in the rollback-ed revision are restored, and
    become orphan, because they are already marked as "R" in the
    restored dirstate and expected to be unlinked

  - standins added in the rollback-ed revision are left as they were
    before rollback, because they are not included in the new parent
    (this may not be so serious)

This patch replaces the "merge.update" invocation with a specific
implementation to restore standins according to restored dirstate.

This is also the preparation to centralize the logic of updating
largefiles into the function wrapping "merge.update" in the subsequent
patch.

After that patch, "merge.update" will also update largefiles in the
working directory and be redundant for restoring standins only.
2014-08-24 23:47:25 +09:00
FUJIWARA Katsunori
1b49e33c21 largefiles: restore standins from non branch-tip parent at rollback correctly
Before this patch, "hg rollback" can't restore standins correclty, if:

  - old parent of the working directory is rollback-ed, and
  - new parent of the working directory is not branch-tip

"overriderollback" uses "merge.update" as a kind of "revert" utility
to restore only standins with "node=None", and this makes
"merge.update" choose "branch-tip" revision as the updating target
unexpectedly.

Then, "merge.update" restores standins from the branch-tip revision
regardless of the parent of the working directory after rollback and
this may cause unexpected behavior.

This patch invokes "merge.update" with "node='.'" to restore standins
from the parent revision of the working directory.

In fact, this "merge.update" invocation will be replaced in the
subsequent patch to fix another problem, but this change is usefull to
inform reason why such complicated case should be tested.
2014-08-24 23:47:25 +09:00
FUJIWARA Katsunori
9bb4aa1522 largefiles: omit restoring standins if working parent is not rollbacked
For efficiency, this patch omits restoring standins and updating
lfdirstate, if the parent of the working directory is not rollbacked.

This patch adds the test not to confirm whether restoring is skipped
or not, but to detect unexpected regression in the future: it is
difficult to distinguish between skipping and perfectly restoring.
2014-08-24 23:47:25 +09:00
Matt Mackall
9bc396577d repoview: fix 0L with pack/unpack for 2.4 2014-08-26 13:11:53 +02:00
Mike Edgar
7d4f56ed60 histedit: use str.startswith to check for comments in action list 2014-08-22 16:40:34 -04:00
Mike Edgar
f32b610c93 histedit: drop duplicate line extracting keep option 2014-08-22 16:37:55 -04:00
FUJIWARA Katsunori
baa5c6430a import: avoid editor invocation when importing with "--exact" for exact-ness
Before this patch, external editor is invoked when imported patch has
no commit message, even if "--exact" is specified. Then, exact-ness is
broken, because empty commit message causes failure of committing.

This patch avoids editor invocation at importing with "--exact" for
exact-ness, because commit message in the patch should be kept as it
is in such case, even if it is empty.
2014-08-23 23:03:50 +09:00
FUJIWARA Katsunori
ba4ea74b2b import: disallow meaningless combination of "--exact" and "--edit"
Before this patch, "hg import" allows combination of "--exact" and
"--edit", even though editing commit message breaks exact-ness.

This patch disallows meaningless combination of "--exact" and "--edit".
2014-08-23 23:03:50 +09:00
Mads Kiilerich
7f9b497a4c incoming: don't request heads that already are common
Pull would send a getbundle command where common heads were sent both as common
and head, even though there is no reason to request a common head.
The request was thus twice as big as necessary and more likely to hit HTTP
header size limits.

Instead, don't request heads that already are common.

This is fixed in bundlerepo.getremotechanges . It could perhaps also have been
fixed in discovery.findcommonincoming but that would have a bigger impact.
2014-08-15 03:24:40 +02:00
Mads Kiilerich
c6b11d841f tests: improve test coverage for discovery and actual parameters for pulling 2014-08-15 03:24:40 +02:00
Mads Kiilerich
af05e75b06 changectx: ancestor should only prefer merge.preferancestor if it is a revision
The value '*' currently designates that bid merge should be used. The best
way to test bid merge is to set preferancestor=* in the configuration file ...
but then it would abort with unknown revision '*' when other code paths ended
up in changectx.ancestor .

Instead, just skip and ignore the value '*' when looking for a preferred
ancestor.
2014-08-15 02:46:44 +02:00