Commit Graph

974 Commits

Author SHA1 Message Date
Pierre-Yves David
5ac8c7b10a addchangegroup: remove the lock argument on the addchangegroup methods
This argument is no longer require. post lock release code is now handled with
dedicated post release callback code in lock itself.
2011-11-28 01:32:13 +01:00
Pierre-Yves David
3e4593fedf addchangegroup: use a postrelease callback to call changegroup hook
This is will allow addchangegroup to drop lock related code.
2011-11-28 01:18:15 +01:00
Pierre-Yves David
a72322069e lock: add mechanism to register post release callback 2011-11-28 15:05:26 +01:00
Pierre-Yves David
e719727169 phases: set common changeset to public on pull 2011-11-11 00:22:02 +01:00
Pierre-Yves David
bf6f3ef1a7 phases: mark content pushed as public in local repo on push 2011-11-11 00:21:17 +01:00
Pierre-Yves David
493771f789 phases: marked content of a changegroup as published 2011-11-11 00:19:00 +01:00
Pierre-Yves David
0f1186823a phases: set new commit in 1-phase 2011-11-11 00:15:22 +01:00
Pierre-Yves David
e62e01ae47 phases: handle unknown nodes in boundary
We filter unknown node out of the boundary. No data is lost. A
filtering is explicitly done after strip too
2011-11-07 13:20:22 +01:00
Pierre-Yves David
75d76cce5b phases: add rollback support 2011-11-07 12:27:25 +01:00
Pierre-Yves David
7ab6d68a9a phases: add a moveboundary function to move phases boundaries
Also include logic to detect when to write phases data.
2011-11-07 14:11:01 +01:00
Pierre-Yves David
abd6a568e7 phases: add a cache allowing to know in which phase a changeset is 2011-11-04 00:20:20 +01:00
Pierre-Yves David
ff2323c4af phases: basic I/O logic
Add function to read and write phase roots. Add a _phaseroots filecache on
localrepo class to access the phaseroots data.
2011-11-04 00:16:24 +01:00
Matt Mackall
e8067d2be1 localrepo: add revs helper method 2011-11-02 13:37:34 -05:00
Matt Mackall
b066b57e3c backout 17bc9a6bb165 (issue3077) (issue3071)
Using util.realpath turns out to create complex issues on both Mac and
Windows. Back this change out for the release.
2011-10-29 11:02:23 -05:00
Thomas Arendsen Hein
51c498ead0 consistency: use util.realpath instead of os.path.realpath where useful
exceptions:
  hg: os.path.realpath used before util can be imported
  tests/run-tests.py: may not import mercurial modules
2011-10-24 13:51:24 +02:00
Matt Mackall
788df2a72b windows: sanity-check symlink placeholders
On Windows, we store symlinks as plain files with the link contents.
Via user error or NFS/Samba assistance, these files often end up with
'normal' file contents. Committing these changes thus gives an
invalid symlink that can't be checked out on Unix.

Here we filter out any modified symlink placeholders that look
suspicious when computing status:

- more than 1K (looks more like a normal file)
- contain NULs (not allowed on Unix, probably a binary)
- contains \n (filenames can't contain \n, very unusual for symlinks,
  very common for files)
2011-10-23 16:32:27 -05: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
Augie Fackler
6d4a8aa3a9 bookmarks: delegate writing to the repo just like reading
This makes it easier for alternate storage backends to not use flat
files for bookmarks storage.
2011-10-12 11:09:57 -05:00
Matt Mackall
9b00238567 rollback: use a hint for force 2011-10-01 16:18:51 -05:00
Greg Ward
3e3c1d99c8 rollback: avoid unsafe rollback when not at tip (issue2998)
You can get into trouble if you commit, update back to an older
changeset, and then rollback. The update removes your valuable changes
from the working dir, then rollback removes them history. Oops: you've
just irretrievably lost data running nothing but core Mercurial
commands. (More subtly: rollback from a shared clone that was already
at an older changeset -- no update required, just rollback from the
wrong directory.)

The fix assumes that only "commit" transactions have irreplaceable
data, and allows rolling back non-commit transactions as always. But
when rolling back a commit, check that the working dir is checked out
to tip, i.e. the changeset we're about to destroy. If not, abort. You
can get back the old (dangerous) behaviour with --force.
2011-09-30 21:58:54 -04:00
Greg Ward
cf0ea44613 rollback: only restore dirstate and branch when appropriate.
If the working dir parent was destroyed by rollback, then the old
behaviour is perfectly reasonable: restore dirstate, branch, and
bookmarks. That way the working dir moves back to an existing
changeset rather than becoming an orphan.

But if the working dir parent was unaffected -- say, you updated to an
older changeset and then did rollback -- then it's silly to restore
dirstate and branch. So don't do that. Leave the status of the working
dir alone. (But always restore bookmarks, because that file refers to
changeset IDs that may have been destroyed.)
2011-09-18 19:59:33 -04:00
Greg Ward
50490dab06 rollback: refactor for readability; cosmetics.
- clarify how we parse undo.desc
- fix bad grammar in an error message
- factor out ui local
- rename some local variables
- standardize string quoting
2011-09-16 21:38:06 -04:00
Greg Ward
5dc38028a3 share: allow trailing newline on .hg/sharedpath.
This is extremely handy for those occasional circumstances where you
need to edit .hg/sharedpath manually, since modern Unix text editors
make it surprisingly difficult to create a text file with no trailing
newline.
2011-09-14 22:28:27 -04:00
Greg Ward
897039c55d rollback: improve readability; clarify that the return value is an int. 2011-09-11 21:21:58 -04:00
Greg Ward
bc1dfb1ac9 atomictempfile: make close() consistent with other file-like objects.
The usual contract is that close() makes your writes permanent, so
atomictempfile's use of close() to *discard* writes (and rename() to
keep them) is rather unexpected. Thus, change it so close() makes
things permanent and add a new discard() method to throw them away.
discard() is only used internally, in __del__(), to ensure that writes
are discarded when an atomictempfile object goes out of scope.

I audited mercurial.*, hgext.*, and ~80 third-party extensions, and
found no one using the existing semantics of close() to discard
writes, so this should be safe.
2011-08-25 20:21:04 -04:00
Idan Kamara
e37d7b9cbe localrepo: unify tag related info into a tagscache class 2011-07-25 15:08:57 +03:00
Idan Kamara
00456bfe26 localrepo: make invalidate() walk _filecache 2011-07-25 15:08:37 +03:00
Idan Kamara
a2947574cb localrepo: decorate manifest() with filecache 2011-07-25 15:08:37 +03:00
Idan Kamara
91c5accca8 localrepo: decorate _bookmarks/current with filecache
nodebookmarks() can be cached as well, leaving for later
2011-07-25 15:08:37 +03:00
Idan Kamara
61b90b0061 localrepo: decorate changelog() with filecache 2011-07-25 15:08:37 +03:00
Idan Kamara
398def5032 localrepo: refresh filecache entries after releasing a repo.lock() 2011-07-25 15:08:37 +03:00
Idan Kamara
e627b89651 localrepo: decorate dirstate() with filecache
We refresh the stat info when releasing repo.wlock(), right after writing it.

Also, invalidate the dirstate by deleting its attribute. This will force a
stat by the decorator that actually checks if anything changed, rather than
reading it again every time.

Note that prior to this, there was a single dirstate instance created for a
localrepo. It was invalidated by calling dirstate.invalidated(), clearing
its internal attributes.

As a consequence, the following construct is no longer safe:

  ds = repo.dirstate # keep a reference to the repo's dirstate
  wlock = repo.wlock()
  try:
      ds.setparents(...)
  finally:
      wlock.release() # dirstate should be written here

Since it's possible that the dirstate was modified between lines #1 and #2,
therefore changes to the old dirstate won't get written when the lock releases,
because a new instance was created by the decorator.
2011-07-25 15:08:37 +03:00
Idan Kamara
1c37933f72 localrepo: add a cache with stat info for files under .hg/ 2011-07-25 15:08:37 +03:00
Andrew Pritchard
99a944ad65 localrepo: make requirements attribute of newly-created repos contain a set
This is for internal consistency, as this attribute typically contains a set
2011-07-20 18:23:06 -04:00
Matt Mackall
fa1960ed0a localrepo: fix comment on set 2011-07-22 16:46:22 -05:00
Matt Mackall
5d4db33567 localrepo: add set method to iterate over a given revset
This should allow replacing a number of hand-rolled graph algorithms.
2011-07-21 14:06:55 -05:00
Matt Mackall
c78a7611d4 subrepo: use working copy of .hgsub to filter status (issue2901) 2011-07-13 17:41:49 -05:00
Mads Kiilerich
e8138203dd util: rename the util.localpath that uses url to urllocalpath (issue2875)
util is never imported by any other name than util, so this is mostly just a
simple search and replace from util.localpath to util.urllocalpath (assuming
other uses of util.localpath already has been renamed).
2011-07-01 17:37:09 +02:00
Wagner Bruna
a57ec020c9 localrepo: mark progress step for translation 2011-06-26 15:47:39 -03:00
Idan Kamara
3910bf241e localrepo: don't attempt to open .hgtags twice if the error isn't ENOENT 2011-06-15 23:15:04 +03:00
Matt Mackall
abe73723fb localrepo: local() returns self
Temporary measure for introducing peers
2011-06-13 12:51:38 -05:00
Matt Mackall
1b52b02896 check-code: catch misspellings of descendant
This word is fairly common in Mercurial, and easy to misspell.
2011-06-07 17:02:54 -05:00
Matt Mackall
c347d649b8 subrepo: be more careful with deletions of .hgsub and .hgsubstate (issue2844)
We shouldn't try to process subrepos if .hgsub isn't present and we
should remove .hgsubstate if .hgsub is marked for removal.
2011-06-06 15:17:40 -05:00
Patrick Mezard
f99a853422 localrepo: add savecommitmessage() to write last-message.txt 2011-06-04 15:56:48 +02:00
Sune Foldager
5d8acb706f localrepo: simplify file bundling code and fix progress bug
Progress for files was off by one, and the code was rather hackish.
2011-06-03 20:23:32 +02:00
Sune Foldager
307e81bf40 localrepo: use list comprehension instead of generators
The lists in question are iterated and kept in memory further down the code
path anyway, and this simplifies things.
2011-06-03 20:15:06 +02:00
Sune Foldager
e4e3ee35de localrepo: add total to changeset progress in bundle/push 2011-06-03 20:12:37 +02:00
Martin Geisler
af8a35e078 check-code: flag 0/1 used as constant Boolean expression 2011-06-01 12:38:46 +02:00
Adrian Buehlmann
924c56c606 introduce new function scmutil.readrequires
for reading and parsing the .hg/requires file
2011-05-31 19:16:18 +02: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