Commit Graph

81 Commits

Author SHA1 Message Date
Alexis S. L. Carvalho
4bc9e33d0e convert: add a mode where mercurial_sink skips empty revisions.
The getchanges function of some converter_source classes can return
some false positives.  I.e. they sometimes claim that a file "foo"
was changed in some revision, even though its contents are still the
same.

convert_svn is particularly bad, but I think this can also happen with
convert_cvs and, at least in theory, with mercurial_source.

For regular conversions this is not really a problem - as long as
getfile returns the right contents, we'll get a converted revision
with the right contents.  But when we use --filemap, this could lead
to superfluous revisions being converted.

Instead of fixing every converter_source, I decided to change
mercurial_sink to work around this problem.

When --filemap is used, we're interested only in revisions that touch
some specific files.  If a revision doesn't change any of these files,
then we're not interested in it (at least for revisions with a single
parent; merges are special).

For mercurial_sink, we abuse this property and rollback a commit if
the manifest text hasn't changed.  This avoids duplicating the logic
from localrepo.filecommit to detect unchanged files.
2007-10-04 23:21:37 -03:00
Bryan O'Sullivan
5e33599d0f Merge with crew. 2007-10-02 13:49:36 -07:00
Bryan O'Sullivan
3ba6252dc7 convert: fail properly if we can't read a source hg repository 2007-10-02 13:48:52 -07:00
Patrick Mezard
091596b961 Merge with crew-stable 2007-09-30 12:36:11 +02:00
Patrick Mezard
12ec5fa979 convert: fix missing import 2007-09-30 12:08:33 +02:00
Bryan O'Sullivan
cfd6f17898 Merge with crew-stable. 2007-09-29 21:10:54 -07:00
Bryan O'Sullivan
4f30385a85 convert: delete empty directories if deleting a file (bug 754) 2007-09-29 21:08:14 -07:00
Alexis S. L. Carvalho
7dac6f1262 convert: mercurial_source: also search for copies in modified files
There are some corner cases where we may have a copy in a file that
isn't in the added list:

- the result of a hg copy --after --force

- after a merge across a (local) rename
2007-09-01 02:49:18 -03:00
Alexis S. L. Carvalho
6309fee56a convert: clear the dirstate before a conversion, invalidate it afterwards
Clearing it before the conversion protects us from whatever data were
there (file copies in particular).

Invalidating it after the conversion avoids writing a possibly
inconsistent dirstate to disk.
2007-09-01 02:49:18 -03:00
Alexis S. L. Carvalho
41b6be949d convert: avoid dirstate checks; add a test
During a conversion, the dirstate contents are not consistent - there
are files that may be missing from the dirstate and there may be files
that shouldn't be in the dirstate.

While this is not fixed, don't mark files as added - put them directly
in state 'n'ormal.
2007-09-01 02:49:18 -03:00
Brendan Cully
4d5be2d7bc convert: new config variable hg.tagsbranch controls which branch tags are committed to 2007-08-27 15:39:07 -07:00
Alexis S. L. Carvalho
d999b43c2b convert: fix mercurial_sink.putcommit
Changeset 31be2f4d36a5 added some code to putcommit to avoid creating a
revision that touches no files, but this can break regular conversions
from some repositories:

- conceptually, since we're converting a repo, we should try to make
  the new hg repo as similar as possible to the original repo - we
  should create a new changeset, even if the original revision didn't
  touch any files (maybe the commit message had some important bit);

- even if a "regular" revision that doesn't touch any file may seem
  weird (and maybe even broken), it's completely legitimate for a merge
  revision to not touch any file, and, if we just skip it, the
  converted repo will end up with wrong history and possibly an extra
  head.

  As an example, say the crew and main hg repos are sync'ed.  Somebody
  sends an important patch to the mailing list.  Matt quickly applies
  and pushes it.  But at the same time somebody also applies it to crew
  and pushes it.  Suppose the commit message ended up being a bit
  different (say, there was a typo and somebody didn't fix it) or that
  the date ended up being different (because of different patch-applying
  scripts): the changeset hashes will be different, but the manifests
  will be the same.

  Since both changesets were pushed to public repos, it's hard to recall
  them.  If both are merged, the manifest from the resulting merge
  revision will have the exact same contents as its parents - i.e. the
  merge revision really doesn't touch any file at all.

To keep the file filtering stuff "working", the generic code was changed
to skip empty revisions if we're filtering the repo, fixing a bug in the
process (we want parents[0] instead of tip).
2007-08-17 20:18:05 -03:00
Brendan Cully
0893e6763c convert: hg: optionally create branches as clones
If convert.hg.clonebranches is set, branches will be created as clones of
their parent revisions. All clones will be subdirectories of the
destination path.
2007-08-15 13:21:23 -07:00
Thomas Arendsen Hein
e34927453f Remove trailing spaces, fix indentation 2007-08-07 10:28:43 +02:00
Bryan O'Sullivan
46d9ef5fcf convert: only get history for requested revs when converting hg repo 2007-08-06 14:16:50 -07:00
Brendan Cully
e14b56ed31 convert: look up copies in getchanges instead of getcommit
svn: defer path expansion until getchanges to reduce latency, as well as memory
usage when converting incrementally.
2007-08-05 12:03:27 -07:00
Alexis S. L. Carvalho
181f0a3596 convert: fix locking order 2007-08-02 01:56:08 -03:00
Bryan O'Sullivan
bfb3dfc715 convert: add config option to turn off use of branch names 2007-07-31 17:18:59 -07:00
Bryan O'Sullivan
4b8b41843e convert: get rid of "hg." prefix where not needed 2007-07-26 13:34:36 -07:00
Bryan O'Sullivan
30c0638736 convert: add filename filtering and renaming support 2007-07-26 13:34:36 -07:00
Bryan O'Sullivan
2eb79e019f convert: acquire/release locks periodically 2007-07-26 13:34:36 -07:00
Bryan O'Sullivan
73b8ede983 convert: Support Mercurial as a source, as well as a sink 2007-07-26 13:34:36 -07:00
Bryan O'Sullivan
fe20ca5067 convert: rename mapfile to revmapfile, so we can map more than just revs 2007-07-26 13:34:36 -07:00
Matt Mackall
c2967290a5 dirstate: add __contains__ and make __getitem__ more useful
dirstate.state(f) == '?' -> f not in dirstate
dirstate.state(f) -> dirstate[f]
2007-07-21 16:02:09 -05:00
Matt Mackall
cf691df912 dirstate: break update into separate functions 2007-07-21 16:02:09 -05:00
Brendan Cully
ee2cc772b4 convert: record the source revision in the changelog 2007-07-13 08:28:57 -07:00
Daniel Holth
b6da512597 convert extension: Add SVN converter 2007-07-01 23:56:11 +02:00
Brendan Cully
a29de605a9 convert: split converter into convertsource and convertsink 2007-07-01 19:58:19 -07:00
Brendan Cully
ee1924281e convert: add -r argument specifying latest revision to convert 2007-07-01 15:02:15 -07:00
Edouard Gomez
8076a27777 convert extension: Add support for username mapping
Allows mapping usernames to new ones during conversion process.
 - Use -A option for first import
 - Then at the end of the conversion process and if the destination
   repo supports authorfile attribute, author map content is copied
   to the file pointed by the authorfile call.
 - On incremental conversions w/o any -A option specified, the
   destination authorfile, if any, gets read automatically.

EG: This allows mapping unix system usernames used in CVS accounts
    to a more typical "Firstname Lastname <address@server.org>" pair.
2007-06-14 23:25:55 +02:00
Brendan Cully
76de3f4dbc Split convert extension into common and repository type modules 2007-06-10 20:08:47 -07:00