Commit Graph

429 Commits

Author SHA1 Message Date
Thomas Arendsen Hein
91a8201c52 merge: warn about file deleted in one branch and renamed in other (issue3074)
For divergent renames the following message is printed during merge:
note: possible conflict - file was renamed multiple times to:
 newfile
 file2

When a file is renamed in one branch and deleted in the other, the file still
exists after a merge. With this change a similar message is printed for mv+rm:

note: possible conflict - file was deleted and renamed to:
 newfile
2012-05-23 20:50:16 +02:00
Brodie Rao
d36ae7f264 localrepo: add branchtip() method for faster single-branch lookups
For the PyPy repo with 744 branches and 843 branch heads, this brings
hg log -r default over NFS from:

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
        3249            0      1.3222      1.3222   <open>
        3244            0      0.6211      0.6211   <method 'close' of 'file' objects>
        3243            0      0.0800      0.0800   <method 'read' of 'file' objects>
        3241            0      0.0660      0.0660   <method 'seek' of 'file' objects>
        3905            0      0.0476      0.0476   <zlib.decompress>
        3281            0      2.6756      0.0472   mercurial.changelog:182(read)
       +3281            0      2.5256      0.0453   +mercurial.revlog:881(revision)
       +3276            0      0.0389      0.0196   +mercurial.changelog:28(decodeextra)
       +6562            0      0.0123      0.0123   +<method 'split' of 'str' objects>
       +6562            0      0.0408      0.0073   +mercurial.encoding:61(tolocal)
       +3281            0      0.0054      0.0054   +<method 'index' of 'str' objects>
        3241            0      2.2464      0.0456   mercurial.revlog:818(_loadchunk)
       +3241            0      0.6205      0.6205   +<method 'close' of 'file' objects>
       +3241            0      0.0765      0.0765   +<method 'read' of 'file' objects>
       +3241            0      0.0660      0.0660   +<method 'seek' of 'file' objects>
       +3241            0      1.4209      0.0135   +mercurial.store:374(__call__)
       +3241            0      0.0122      0.0107   +mercurial.revlog:810(_addchunk)
        3281            0      2.5256      0.0453   mercurial.revlog:881(revision)
       +3280            0      0.0175      0.0175   +mercurial.revlog:305(rev)
       +3281            0      2.2819      0.0119   +mercurial.revlog:847(_chunkraw)
       +3281            0      0.0603      0.0083   +mercurial.revlog:945(_checkhash)
       +3281            0      0.0051      0.0051   +mercurial.revlog:349(flags)
       +3281            0      0.0040      0.0040   +<mercurial.mpatch.patches>
       13682            0      0.0479      0.0248   <method 'decode' of 'str' objects>
       +7418            0      0.0228      0.0076   +encodings.utf_8:15(decode)
          +1            0      0.0003      0.0000   +encodings:71(search_function)
        3248            0      1.3995      0.0246   mercurial.scmutil:218(__call__)
       +3248            0      1.3222      1.3222   +<open>
       +3248            0      0.0235      0.0184   +os.path:80(split)
       +3248            0      0.0084      0.0068   +mercurial.scmutil:92(__call__)
Time: real 2.750 secs (user 0.680+0.000 sys 0.360+0.000)

down to:

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
          55           31      0.0197      0.0163   <__import__>
          +1            0      0.0006      0.0002   +mercurial.context:8(<module>)
          +1            0      0.0042      0.0001   +mercurial.revlog:12(<module>)
          +1            0      0.0002      0.0001   +mercurial.match:8(<module>)
          +1            0      0.0003      0.0001   +mercurial.dirstate:7(<module>)
          +1            0      0.0057      0.0001   +mercurial.changelog:8(<module>)
           1            0      0.0117      0.0032   mercurial.localrepo:525(_readbranchcache)
        +844            0      0.0015      0.0015   +<binascii.unhexlify>
        +845            0      0.0010      0.0010   +<method 'split' of 'str' objects>
        +843            0      0.0045      0.0009   +mercurial.encoding:61(tolocal)
        +843            0      0.0004      0.0004   +<method 'setdefault' of 'dict' objects>
          +1            0      0.0003      0.0003   +<method 'close' of 'file' objects>
           3            0      0.0029      0.0029   <method 'read' of 'file' objects>
           9            0      0.0018      0.0018   <open>
         990            0      0.0017      0.0017   <binascii.unhexlify>
          53            0      0.0016      0.0016   mercurial.demandimport:43(__init__)
         862            0      0.0015      0.0015   <_codecs.utf_8_decode>
         862            0      0.0037      0.0014   <method 'decode' of 'str' objects>
        +862            0      0.0023      0.0008   +encodings.utf_8:15(decode)
         981            0      0.0011      0.0011   <method 'split' of 'str' objects>
         861            0      0.0046      0.0009   mercurial.encoding:61(tolocal)
        +861            0      0.0037      0.0014   +<method 'decode' of 'str' objects>
         862            0      0.0023      0.0008   encodings.utf_8:15(decode)
        +862            0      0.0015      0.0015   +<_codecs.utf_8_decode>
           4            0      0.0008      0.0008   <method 'close' of 'file' objects>
         179          154      0.0202      0.0004   mercurial.demandimport:83(__getattribute__)
         +36           11      0.0199      0.0003   +mercurial.demandimport:55(_load)
         +72            0      0.0001      0.0001   +mercurial.demandimport:83(__getattribute__)
         +36            0      0.0000      0.0000   +<getattr>
           1            0      0.0015      0.0004   mercurial.tags:148(_readtagcache)
Time: real 0.060 secs (user 0.030+0.000 sys 0.010+0.000)
2012-05-13 14:04:04 +02:00
Patrick Mezard
d99bfab018 rebase: allow collapsing branches in place (issue3111)
We allow rebase plus collapse, but not collapse only? I imagine people would
rebase first then collapse once they are sure the rebase is correct and it is
the right time to finish it.

I was reluctant to submit this patch for reasons detailed below, but it
improves rebase --collapse usefulness so much it is worth the ugliness.

The fix is ugly because we should be fixing the collapse code path rather than
the merge. Collapsing by merging changesets repeatedly is inefficient compared
to what commit --amend does: commitctx(), update, strip. The problem with the
latter is, to generate the synthetic changeset, copy records are gathered with
copies.pathcopies(). copies.pathcopies() is still implemented with merging in
mind and discards information like file replaced by the copy of another,
criss-cross copies and so forth. I believe this information should not be lost,
even if we decide not to interpret it fully later, at merge time.

The second issue with improving rebase --collapse is the option should not be
there to begin with. Rebasing and collapsing are orthogonal and a dedicated
command would probably enable a better, simpler ui. We should avoid advertizing
rebase --collapse, but with this fix it becomes the best shipped solution to
collapse changesets.

And for the record, available techniques are:
- revert + commit + strip: lose copies
- mq/qfold: repeated patching() (mostly correct, fragile)
- rebase: repeated merges (mostly correct, fragile)
- collapse: revert + tag rewriting wizardry, lose copies
- histedit: repeated patching() (mostly correct, fragile)
- amend: copies.pathcopies() + commitctx() + update + strip
2012-05-03 15:14:58 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Patrick Mezard
2c65c226cf localrepo: add setparents() to adjust dirstate copies (issue3407)
The fix introduced in 3509b9cf8f86 was only partially successful. It is correct
to turn dirstate 'm' merge records into normal/dirty ones but copy records are
lost in the process. To adjust them as well, we need to look in the first
parent manifest to know which files were added and preserve only related
records. But the dirstate does not have access to changesets, the logic has to
moved at another level, in localrepo.
2012-04-29 22:25:55 +02:00
Matt Mackall
300b5fdbe1 merge: check for untracked files more precisely (issue3400)
This fixes the regression, but still leaves the long-standing issue
that merge doesn't cope with trying to merge files and directories.
2012-04-27 13:18:09 -05:00
Patrick Mezard
d7a11b26ae update: fix case-collision with a clean wd and no --clean
a317664437ee introduced some logic to avoid case-collision detection between
source and destination revisions when it does not make sense: clean or to be
cleaned working directories. Unfortunately, part of it was flawed and the
related test was broken by another bug.

This patch disables cross revision case collision detection for updates without
option or with --check, if the working directory is clean.
2012-04-23 14:32:59 +02:00
FUJIWARA Katsunori
15d40e6d68 icasefs: make case-folding collision detection as rename aware (issue3370)
if the file in target context causes case-folding collision against
one in working context, current implementation aborts merging with it,
even thouhg collding one (in target) is the file renamed from collided
one (in working).

this patch uses file copy information to know whether colliding file
is renamed from collided one or not: if so, collision between them is
ignored.

this patch also avoids collision detection between current context and
target context, if working context is clean (with --check/-c) or will
be clean (with --clean/-C).
2012-04-16 01:11:29 +09:00
Matt Mackall
6d3a783a57 merge: fix unknown file merge detection for case-folding systems
This was triggering some test failures on Mac.
2012-03-26 16:41:54 -05:00
Matt Mackall
61779234ab merge with stable 2012-03-15 13:11:42 -05:00
Matt Mackall
89d8d8b996 merge: accept missing revisions in symlink flag merge (issue3316) 2012-03-14 14:45:41 -05:00
Matt Mackall
2a84e7e364 merge with stable 2012-03-13 16:29:13 -05:00
Matt Mackall
5eda7202ad merge: handle linear update to symlink correctly (issue3316)
This fixes a regression introduced by df049e784ab6. If no file-level
merge is needed, we can update flags directly, otherwise we have a
conflict to resolve in filemerge.
2012-03-13 16:28:08 -05:00
Matt Mackall
26807610cb copies: remove checkdirs options
This removes the undocumented merge.followdirs option, which has
always been true.
2012-02-25 14:22:58 -06:00
Matt Mackall
630fa7d8fc merge: defer symlink flag merging to filemerge (issue3200)
Previously, we could change a normal file into a corrupt symlink when
trying to merge a symlink flag. Now, we leave the flag alone and let
filemerge deal with it (usually by a prompt).

We also drop a redundant flag setting after filemerge (now dealt with
by ms.resolve) that would cause similar corruption.
2012-01-26 20:34:57 -06:00
Matt Mackall
1b38343e48 update: just merge unknown file collisions
The unknown file collision rule was introduced as an extension of the
"should be clean when merging" rule. Unfortunately, it got applied to
the normal update path, which should be happy to merge local changes.

This patch gives us merges for unknown file collisions on update,
while preserving abort for merge and update -c.
2012-02-09 17:54:47 -06:00
Matt Mackall
e3a172f2f0 merge: don't use unknown()
This removes use of unknown files for building the synthetic working
directory manifest used by manifestmerge. Instead, we adopt the
strategy used by _checkunknown.

Side-effect: unknown files are no longer moved by remote directory
renames, and now are left alone like ignored files.
2012-02-09 17:04:17 -06:00
Matt Mackall
f454042775 merge: refactor unknown file conflict checking
Previously, we would do a full working directory walk including
unknown files to perform a merge. In many cases, this was painful
because unknown files greatly outnumbered tracked files and generally
had no useful effect on the merge.

Here we instead wait until we find a file in the destination that's
not tracked locally and detect if it exists and is not ignored. This
is usually cheaper but can be -more- expensive in the case where we're
adding a huge number of files. On the other hand, the cost of statting
the new files should be dwarfed by the cost of eventually writing
them.

In this version, case collisions are detected implicitly by
os.path.exists and wctx[f] lookup.
2012-02-09 16:50:19 -06:00
Matt Mackall
1ceb79342c update: use normal update path with --check (issue2450)
This avoids clobbering unknown files on update by not using overwrite mode.
2012-02-09 13:16:20 -06:00
Jordi Gutiérrez Hermoso
b28181a568 merge: report all files in _checkunknown
When doing hg up, if there is a file conflict with untracked files,
currently only the first such conflict is reported. With this patch,
all of them are listed.

With this patch error message is now reported as

    a: untracked file differs
    b: untracked file differs
    abort: untracked files in working directory conflict with files in
    requested revision

instead of

    abort: untracked file in working directory differs from file in
    requested revision: 'a'

This is a follow up to an old attempt to do this here:

    http://selenic.com/pipermail/mercurial-devel/2011-August/033625.html
2012-01-11 15:53:42 -05:00
Matt Mackall
9bfa890ee6 copies: split the copies api for "normal" and merge cases (API) 2012-01-04 15:48:02 -06:00
Matt Mackall
7cf4e6eacb merge with stable 2011-12-16 19:05:59 -06:00
FUJIWARA Katsunori
1a00d3603f merge: check filename case collision between changesets for branch merging
this patch makes branch merging abort when merged changesets have same
file in different case on case insensitive filesystem.

this patch does not prevent linear update which merges between target
and working contexts, because 'branchmerge' is False in such case.
2011-12-16 21:21:27 +09:00
Matt Mackall
03f5247248 merge with stable 2011-12-15 14:37:36 -06:00
FUJIWARA Katsunori
ee602b5c96 icasefs: use util.normcase() instead of str.lower() or os.path.normpath() 2011-12-12 17:10:19 +09:00
Mads Kiilerich
ba2b5b0d23 update: don't clobber untracked files with wrong casing 2011-11-20 23:09:32 +01:00
Martin Geisler
ae8ca6aff5 merge: make debug output easier to read
I always found it hard to figure out what the debug code meant without
the separators.
2011-12-09 17:34:53 +01:00
Kevin Bullock
4b1f198355 merge: make 'nothing to merge' aborts consistent
Makes the 'nothing to merge' abort messages in commands.py consistent with
those in merge.py. Also makes commands.merge() and merge.update() use hints.
The tests show the changes.
2011-12-07 11:23:01 -06:00
Martin Geisler
5767d9d56f merge: use repo.ui directly instead local variable
The non-standard 'u = repo.ui' shorthand was only used two times and
there were many other full references to repo.ui.
2011-08-17 14:11:46 +02:00
FUJIWARA Katsunori
a423a1ab9d i18n: use UTF-8 string to lower filename for case collision check
Some character sets, cp932 (known as Shift-JIS for Japanese) for
example, use 0x41('A') - 0x5A('Z') and 0x61('a') - 0x7A('z') as second
or later character.

In such character set, case collision checking recognizes different
files as CASEFOLDED same file, if filenames are treated as byte
sequence.

win32mbcs extension is not appropriate to handle this problem, because
this problem can occur on other than Windows platform only if
problematic character set is used.

Callers of util.checkcase() use known ASCII filenames as last
component of path, and string.lower() is not applied to directory part
of path. So, util.checkcase() is kept intact, even though it applies
string.lower() to filenames.
2011-07-28 14:36:07 +09:00
Augie Fackler
a3d0340408 update: check wc.dirty() before setting overwrite=True
merge.update() was missing a few dirtiness checks from workingcontext,
including subrepo cleanliness checks. Using wc.dirty() instead of
one-off checks for various forms of dirtiness will be significantly
safer.
2011-06-17 15:21:02 -05:00
Brendan Cully
ea84333a75 Make pull -u behave like pull && update
Previously, pull would not update if new branch heads were received,
whereas pull && update would move to the tipmost branch head.

Also change the "crosses branches" abort in merge.update from
"crosses branches (merge branches or use --check to force update)"
to
"crosses branches (merge branches or update --check to force update)"

since it can no longer assume the user is running hg update.
2011-05-31 11:52:22 -07:00
Matt Mackall
97c6e7b48d dirstate: rename forget to drop
It has substantially different semantics from forget at the command
layer, so change it to avoid confusion.

We can't simply combine it with remove because we need to explicitly
drop non-added files in some cases like commit.
2011-05-26 17:15:35 -05:00
Adrian Buehlmann
a11d19c5ad applyupdates: audit merged files
protects changing flags on merged files (util.setflags call on line 341)
2011-05-22 11:03:15 +02:00
Adrian Buehlmann
18e5c7b1c9 applyupdates: audit path on flag changes
we're using the auditor of the repo wopener, since this is a path that belongs
to the tree we're updating to
2011-05-21 23:21:12 +02:00
Adrian Buehlmann
4c8d0e46fa applyupdates: audit unlinking of renamed files and directories 2011-05-21 02:05:00 +02:00
Adrian Buehlmann
c415440828 rename util.set_flags to setflags 2011-05-06 15:22:31 +02:00
Adrian Buehlmann
e981d64ef2 rename path_auditor to pathauditor
The Mercurial 1.9 release is moving a lot of stuff around anyway and we are
already moving path_auditor from util.py to scmutil.py for that release.

So this seems like a good opportunity to do such a rename. It also strengthens
the current project policy to avoid underbars in names.
2011-05-06 09:54:06 +02:00
Dan Villiom Podlaski Christiansen
511c941422 prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.

This implies:
 - changing opener(...).read() calls to opener.read(...)
 - changing opener(...).write() calls to opener.write(...)
 - changing open(...).read(...) to util.readfile(...)
 - changing open(...).write(...) to util.writefile(...)
2011-05-02 10:11:18 +02:00
Alexander Solovyov
0eb3836642 remove unused imports and variables 2011-04-30 13:59:14 +02:00
Adrian Buehlmann
307196b733 move path_auditor from util to scmutil 2011-04-20 22:43:31 +02:00
Matt Mackall
a8dd64dcb0 misc: replace .parents()[0] with p1() 2011-04-04 16:21:59 -05:00
Matt Mackall
a9a1073611 merge: add ancestor to the update function
This makes it easier to do rebase-like operations.
2011-04-04 15:25:20 -05:00
Matt Mackall
f8809566c2 merge with stable 2011-03-23 09:20:40 -05:00
Matt Mackall
c989b5dd89 merge: avoid unlinking destination of merge when case changes (issue2715) 2011-03-22 12:00:38 -05:00
Matt Mackall
81bd0b7967 merge: back out single-parent fast-forward merge
This backs out

 changeset:   13158:17d1b96c0f12
 user:        Mads Kiilerich <mads@kiilerich.com>
 date:        Tue Dec 07 03:29:21 2010 +0100
 summary:     merge: fast-forward merge with descendant

Before named branches, the invariants were:

a) "merges" always have two parents
b) p1 is not linearly related to p2

Adding named branches made (b) problematic, so the above patch was
introduced, which fixed (b) but broke (a).

After discussion, we decided that the invariants should be:

a) "merges" always have two parents
b) p1 is not linearly related to p2 OR p1 and p2 are on different branches
2011-03-07 15:03:10 -06:00
Matt Mackall
f9bf397695 merge: drop resolve state for mergers with identical contents (issue2680) 2011-03-05 16:34:59 -06:00
Oleg Stepanov
ee35622d91 Do not allow merging with uncommitted changes in a subrepo 2011-02-16 08:56:11 -08:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Martin Geisler
17df79113a merge with stable 2011-01-31 13:38:00 +01:00
Erik Zielke
bf9e13d063 subrepo: make update -C clean the working directory for svn subrepos
This makes 'hg update --clean' behave the same way for both kinds of
subrepositories. Before Subversion subrepos did not take the clean
parameter into account, but just updated to the given revision and
merged uncommitted changes into that.
2011-01-31 13:33:41 +01:00
Adrian Buehlmann
721e368ac1 rename util.unlink to unlinkpath 2011-01-02 19:34:41 +01:00
Greg Ward
885d349b11 merge: document some internal return values. 2010-12-13 11:46:31 -05:00
Mads Kiilerich
9772d9af5a merge: fast-forward merge with descendant
issue2538 gives a case where a changeset is merged with its child (which is on
another branch), and to my surprise the result is a real merge with two
parents, not just a "fast forward" "merge" with only the child as parent.

That is essentially the same as issue619.

Is the existing behaviour as intended and correct?

Or is the following fix correct?

Some extra "created new head" pops up with this fix, but it seems to me like
they could be considered correct. The old branch head has been superseeded by
changes on the other branch, and when the changes on the other branch is merged
back to the branch it will introduce a new head not directly related to the
previous branch head.

(I guess the intention with existing behaviour could be to ensure that the
changesets on the branch are directly connected and that no new heads pops up
on merges.)
2010-12-07 03:29:21 +01:00
Dan Villiom Podlaski Christiansen
17cfc8fdc9 merge: make 'diverging renames' diagnostic a more helpful note.
See the Hg Book on why we actually want to detect this case:
http://hgbook.red-bean.com/read/mercurial-in-daily-use.html#id364290

Before:

$ hg up deadbeef
warning: detected divergent renames of X to:
...

After:

$ hg up deadbeef
note: possible conflict - X was renamed multiple times to:
...

No functionality change.
2010-10-10 09:50:25 -05:00
timeless
ad9a9b223b merge/progress: marking strings for localization 2010-08-02 07:15:47 +03:00
Brodie Rao
2187fcb2bb update: use higher level wording for "crosses branches" error
When using "hg update" to update to a revision on another branch, if
the user has uncommitted changes in the working directory, hg aborts
with the following message:

  abort: crosses branches (use 'hg merge' to merge or use 'hg update
  -C' to discard changes)

If the user isn't trying to update to tip and they follow the command
examples verbatim, they would end up updating to the wrong revision.

This patch removes the command examples in favor of just telling the
user to either merge or use --clean:

  abort: crosses branches (merge branches or use --clean to discard
  changes)

hg also aborts if the user tries to use "hg update" to get to tip
(without specifying a revision) and tip is on another branch:

  abort: crosses branches (use 'hg merge' or use 'hg update -c')

This message is changed in the same fashion:

  abort: crosses branches (merge branches or use --check to force
  update)
2010-10-09 17:02:28 -05:00
Matt Mackall
bc4d4ff1d1 merge: handle no file parent in backwards merge (issue2364) 2010-10-09 14:50:20 -05:00
Matt Mackall
51b3b09c8f backout most of 26e0b9a8ce0d 2010-09-24 12:46:54 -05:00
Brodie Rao
7362459729 cleanup: use x in (a, b) instead of x == a or x == b 2010-09-23 00:02:31 -05:00
Peter Arrenbrecht
c3d38bfaec merge: delay writing the mergestate during until commit is called
This speeds up merges of lots of files considerably.
2010-09-06 17:35:49 +02:00
Adrian Buehlmann
79059e20c1 combine tests 2010-09-14 12:20:51 +02:00
Martin Geisler
bfea979db3 util: remove lexists, Python 2.4 introduced os.path.lexists 2010-08-25 16:23:32 +02:00
Matt Mackall
5fd0f613e6 merge with stable 2010-08-21 10:48:49 -05:00
Matt Mackall
395274c87f merge: move reverse-merge logic out of filemerge (issue2342) 2010-08-21 10:41:29 -05:00
Alecs King
f476a3469b merge: fix typo in docstring 2010-08-11 20:16:22 +08:00
Matt Mackall
81392aed00 merge: drop reference to file contents after write
This reduces memory usage on large consecutive gets.
2010-08-05 16:17:17 -05:00
timeless
bf09d7af0f progress: use gerund (updating) for merge progress 2010-07-30 10:32:24 +03:00
Matt Mackall
c0eb9c1315 Merge with stable 2010-08-06 12:59:13 -05:00
Matt Mackall
c11fac2ec1 Merge with stable 2010-07-31 18:12:50 -05:00
Nicolas Dumazet
064d677bd7 filectx: use cmp(self, fctx) instead of cmp(self, text)
This allows more flexibility in implementation, and in particular,
lets the context decide if revision text has to be loaded or not.
2010-07-27 23:40:46 +09:00
Matt Mackall
49d11c6847 subrepo: correctly handle update -C with modified subrepos (issue2022)
(based on a patch by Saint Germain)
2010-06-30 23:56:35 -05:00
Matt Mackall
e02c6fa5ff update: synchronize permissions in the dirstate (issue1473)
fix by Benoit, updated by mpm to not affect all clean files
2010-06-30 17:34:20 -05:00
Peter Arrenbrecht
a5728c19b7 merge: pass constant cset ancestor to fctx.ancestor 2010-06-18 08:49:24 +02:00
Martin Geisler
d90427e78b resolve: do not crash on empty mergestate
I managed to get an empty .hg/merge/state file by interrupting a merge
by pressing Control-C. This lead to this error:

  TypeError: a2b_hex() argument 1 must be string or read-only buffer,
  not None

since localnode is assigned None before the iteration over lines in
the mergestate begins.
2010-06-27 23:12:05 +02:00
Matt Mackall
a6428604f4 merge: improve merge with ancestor message 2010-06-20 14:21:56 -05:00
Mads Kiilerich
bd975669e6 merge: remove last traces of fastforward merging
bed0e312bdf5 introduced fast-forward branch merging.
e2079edce509 partly removed it again.

The fastforward variable would always be false if branchmerge was false, so the
fastforward variable makes no difference and we can remove it completely.
2011-03-08 01:21:50 +01:00
Gilles Moris
446a842b86 merge: avoid to break the dirstate copy status on moved files
In the case a file is locally tracked as copied in dirstate, and that a merge
affects this file, this file should not be marked as modified in dirstate, as
this will break the current copy state.
Note: only affect working directory merge, not branch merge.
2010-05-04 09:57:16 +02:00
Matt Mackall
ad8006c15f context: only scan unknowns when needed 2010-05-05 20:21:57 -05:00
Benoit Boissinot
33390381d7 dirstate: more explicit name, rename normaldirty() to otherparent() 2010-04-20 11:17:01 +02:00
Sune Foldager
2369132b4b run commit and update hooks after command completion (issue1827)
Previously, the working dir state hadn't been written when these
hooks were invoked, so external commands couldn't see all changes.
2010-02-17 15:43:21 +01:00
Augie Fackler
dfd90db0f0 update: make calls to ui.progress() 2010-02-07 17:44:30 -06:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Matt Mackall
238098252f submerge: properly deal with overwrites
also pull .hgsubstate check out of inner loop
2009-11-08 10:29:52 -06:00
Matt Mackall
34dc7c3fa5 subrepo: notice dirty subrepo states when merging 2009-11-07 16:30:42 -06:00
Stuart W Marks
c06e10d43b update: allow branch crossing without -c or -C, with no uncommitted changes
Update will now allow crossing branches within the same named branch,
when given a specific revision, if the working dir is clean, without
requiring the -c or -C option. Abort if no revision is given and
this would cross branches.  Minor change to abort message if
uncommitted changes are found.

Modify test-update-branches and output to reflect the altered case. Modify
test-merge5.out to reflect the altered case. Modify
test-up-local-change.out with new message.
2009-11-05 10:53:59 +01:00
Stuart W Marks
34fa5664cf update: add comments and test cases for updating across branches
Add comment to merge.py:update() showing various cases of 'hg update': to a
descendant, crossing named branches, and crossing branches within a named
branch; with no option, -c or -C; with or without uncommitted changes; and
with or without a specific revision. Add tests for all of these cases.
2009-11-05 10:53:36 +01:00
Martin Geisler
9f1896c083 do not attempt to translate ui.debug output 2009-09-19 01:15:38 +02:00
Simon Heimberg
e0e4fc74e3 ui: extract choice from prompt
avoid translating single characters (as l for _local or sym_link)
2009-06-21 01:13:19 +02:00
Alejandro Santos
b1c42d384b compat: can't compare two values of unequal datatypes 2009-07-05 11:01:01 +02:00
Matt Mackall
430046de97 subrepo: add update/merge logic 2009-06-15 02:45:38 -05:00
Matt Mackall
826dfe5eff merge: refactor manifestmerge init to better report effective ancestor 2009-06-08 18:14:44 -05:00
Matt Mackall
664da24230 merge: simplify file revision comparison logic 2009-06-08 18:14:44 -05:00
Matt Mackall
8021cf3e72 merge: make locally-added file test more correct 2009-06-08 18:14:44 -05:00
Matt Mackall
7c7918e441 merge: drop unused diverge initialization 2009-06-08 18:14:44 -05:00
Matt Mackall
810956c62b merge: refactor some initialization, drop backwards var 2009-06-08 18:14:44 -05:00
Matt Mackall
a9d2386a66 merge: combine a copy and move case 2009-06-08 18:14:44 -05:00
Matt Mackall
74a311ea36 merge: drop a flag update case 2009-06-08 18:14:44 -05:00
Matt Mackall
40f6d9b1a4 merge: combine three identical 'remote is newer' cases 2009-06-08 18:14:44 -05:00
Matt Mackall
b9716ff4b9 merge: drop 'remote deleted' case 2009-06-08 18:14:44 -05:00
Matt Mackall
68db9b76df merge: simplify 'other deleted' case 2009-06-08 18:14:44 -05:00
Matt Mackall
003d63fe39 merge: simplify backwards revert test, ready to combine with other cases 2009-06-08 18:14:44 -05:00
Matt Mackall
e7ff3ff5bc merge: allow merging going backwards
New behavior is generally superior and more correct, except possibly
with regards to missing files. hg up . is now effectively a no-op,
which is probably the desired behavior for people expecting to move to
tip, but may surprise people who were expecting deleted files to
reappear.

case 1: update to .

a-w -> a-w

classic: ancestor a
 missing     recreated     right?
 rmed        recreated     WRONG
 added       forgotten     WRONG
 changed     preserved     RIGHT
 conflicted  can't happen

backward merge: ancestor a  (NO EFFECT)
 missing     missing      wrong?
 rm'ed       rm'ed        RIGHT
 added       preserved	  RIGHT
 changed     preserved    RIGHT
 conflicted  can't happen

case 2: update to ancestor of .

a-b-w -> b-w
          \
           a

classic:  ancestor a
 missing       recreated        right?
 rmed          recreated        wrong?
 added         forgotten        wrong?
 changed       preserved        RIGHT
 conflicted    preserved        wrong?

backwards merge: ancestor b
 missing       missing or conflict  right?
 rm'ed         missing or conflict  right?
 changed       preserved            RIGHT
 conflicted    merge                RIGHT
 added         preserved            right?
2009-06-08 18:14:44 -05:00
Matt Mackall
c24a0d4e76 merge: reorder remote creation tests 2009-06-08 18:14:44 -05:00
Matt Mackall
58ccf87682 merge: drop recreating case 2009-06-08 18:14:44 -05:00
Matt Mackall
65d08ecb3f merge: drop an overwrite test 2009-06-08 18:14:44 -05:00
Matt Mackall
fee35db526 merge: simplify a delete case 2009-06-08 18:14:44 -05:00
Matt Mackall
3d83e5d92a merge: reorder get cases for future simplification 2009-06-08 18:14:44 -05:00
Matt Mackall
7d4488886a merge: fix prompt keep 2009-06-08 18:14:44 -05:00
Matt Mackall
2c65849ffa merge: remove a flags case 2009-06-08 18:14:44 -05:00
Matt Mackall
da4ac4f699 merge: pretend ancestor is local to simplify backwards and overwrite 2009-06-08 18:14:44 -05:00
Matt Mackall
60cf366277 merge: simplify flag merging code slightly 2009-06-08 18:14:44 -05:00
Steve Borho
2cd8aa240a merge: give hint as to how to discover uncommitted changes
Many users will try 'hg diff' here, and it will not show them missing files.
2009-05-22 11:42:21 -05:00
Benoit Boissinot
fc43ae9519 update --clean: do not unlink added files (issue575) 2009-05-19 03:59:58 +02:00
Dirkjan Ochtman
43d9564cff some modernization cleanups, forward compatibility 2009-05-13 14:08:39 +02:00
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +02:00
Steve Borho
52bf113f2e ui: replace regexp pattern with sequence of choices
Use ampersands (&) to delineate the response char in each choice.
ui.prompt() responses are now explicitly case insensitive.  GUIs
that subclass ui can generate dialogs from the full choice names.
2009-04-30 10:15:32 -05:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Martin Geisler
e2222d3c43 replace set-like dictionaries with real sets
Many of the dictionaries created by dict.fromkeys were emulating sets.
These can now be replaced with real sets.
2009-04-22 00:57:28 +02:00
Ronny Pfannschmidt
5356baa346 switch lock releasing in the core from gc to explicit 2009-04-22 02:01:22 +02:00
Matt Mackall
805511403b resolve: move reset to localrepo.commit
This way rebase doesn't leave a stale resolve state
2009-03-16 16:58:41 -05:00
Matt Mackall
d7c2a2e49b merge: mark kept local files as readded on linear update (issue539) 2009-02-15 10:50:48 -06:00
Patrick Mezard
6aa7cd6f84 Merge with crew-stable 2009-01-13 23:17:19 +01:00
Patrick Mezard
a70c4ebc9d merge: fix execute bit update issue introduced by db8aabe14ff1 2009-01-13 22:41:06 +01:00
Benoit Boissinot
9eaa24618d correctly update dirstate after update+mode change (issue1456) 2009-01-07 02:11:17 +01:00
Dirkjan Ochtman
574603a8c0 use dict.iteritems() rather than dict.items()
This should be faster and more future-proof. Calls where the result is to be
sorted using util.sort() have been left unchanged. Calls to .items() on
configparser objects have been left as-is, too.
2009-01-12 09:16:03 +01:00
Matt Mackall
48ebb7a1ba merge: fix bug going backwards for already reverted files (issue1303) 2008-10-08 16:22:08 -05:00
Martin Geisler
28fb695e9a i18n: mark strings for translation in Mercurial 2008-08-31 16:12:02 +02:00
Dirkjan Ochtman
6b51480caa merge with crew-stable 2008-08-12 17:47:08 +02:00
Matt Mackall
e03f4e2f73 util: set_flags shouldn't know about repo flag formats 2008-08-10 21:55:06 -05:00
Paul Moore
ab028fc78a Sort removes first when applying updates (fixes issues 750 and 912)
This change ensures that removes happen first in applyupdates(). This avoids
issues where we try to make a case-only rename of a file on a case insensitive
system. Without this patch, the add of the new name happens before the remove
of the old one - which results in the file not existing, as the two names are
effectively the same.

With the patch, the old name gets removed then the new one gets added, which
is always safe.
2008-07-01 17:59:31 +01:00
Matt Mackall
a65ef7bc5d util: add sort helper 2008-06-27 18:28:45 -05:00
Matt Mackall
fbb5127472 use repo[changeid] to get a changectx 2008-06-26 14:35:46 -05:00
Matt Mackall
b2155285a8 rename checkfolding to checkcase 2008-06-26 13:58:24 -05:00
Matt Mackall
5867ff1667 use repo.changectx(None) to get a workingctx 2008-06-26 13:46:29 -05:00
Patrick Mezard
d06361ae38 merge: replace readline() call, missing from posixfile_nt 2008-04-12 20:51:26 +02:00
Matt Mackall
edf5a0f5d0 resolve: new command
- add basic resolve command functionality
- point failed update and merge at resolve
2008-04-11 12:52:56 -05:00
Dirkjan Ochtman
77eea08b47 python-2.6: use sha wrapper from util for new merge code 2008-04-11 12:04:26 +02:00
Matt Mackall
8d82cba09a merge: introduce mergestate 2008-04-10 15:02:24 -05:00
Matt Mackall
c9895536f8 copies: skip directory rename checks when not merging
The directory rename checks are not meaningful unless we're moving or copying
files across a branch during a merge.
2008-03-29 12:39:47 -05:00
Thomas Arendsen Hein
5690af9ff7 Fix missing space in one of the new update messages. 2008-03-24 20:28:13 +01:00
Matt Mackall
fb8b59de16 update: better logic and messages for updates
- complain about attempts to merge with ancestor
- when updating, differentiate between
  - crossing named branches with no local changes (jump)
  - crossing named branches with local changes (complain)
  - nonlinear update on the same named branch, no changes (complain some more)
  - nonlinear update on the same named branch, changes (different complaining)
2008-03-24 10:01:05 -05:00
Matt Mackall
9454e6e5aa update: no -C needed to switch branches without outstanding changes 2008-03-22 13:30:08 -05:00
Matt Mackall
5c5200eb63 diff: use copy smarts from copies.py 2008-03-15 10:02:31 -05:00
Matt Mackall
79c8f65d30 copies: move findcopies code to its own module
- pass in contexts
- fold symmetricdifference check into copies.copies
2008-03-15 10:02:31 -05:00
Matt Mackall
ce54a3ea46 merge: move symmetricdifferences to ancestor.py 2008-03-15 10:02:31 -05:00
Matt Mackall
f1d323b3b4 merge: simplify some helpers 2008-03-15 10:02:31 -05:00
Matt Mackall
67e4145eba merge: more simplifications to checkcopies 2008-03-15 10:02:31 -05:00
Matt Mackall
8cbc2c104e merge: simplify checkcopies 2008-03-15 10:02:31 -05:00