Commits

Pierre-Yves David committed dea67da

amend: add a warning after amend added unstablility

Comments (0)

Files changed (2)

             if not old.phase():
                 raise util.Abort(_("can not rewrite immutable changeset %s") % old)
 
+            # store the amount of unstable prior update
+            if old.children():
+                priorunstables = len(repo.revs('unstable()'))
+            else:
+                #no children mean no change for unstable changeset
+                priorunstables = None
+
             # commit current changes as update
             # code copied from commands.commit to avoid noisy messages
             ciopts = dict(opts)
                     raise error.Abort(_('no updates found'))
             updates = [repo[n] for n in updatenodes]
 
+
+
             # perform amend
             if opts.get('edit'):
                 opts['force_editor'] = True
             # reroute the working copy parent to the new changeset
             phases.retractboundary(repo, old.phase(), [newid])
             repo.dirstate.setparents(newid, node.nullid)
+
+            if priorunstables is not None:
+                newunstables = len(repo.revs('unstable()')) - priorunstables
+                if newunstables > 0:
+                    ui.warn(_('%i new unstables changesets\n') % newunstables)
         finally:
             wlock.release()
     finally:

tests/test-evolve.t

   $ sed -i'' -e s/Eins/Un/ main-file-1
 
   $ hg amend --note 'french looks better'
+  1 new unstables changesets
   $ hg log
   6	feature-A: a nifty feature - test
   4	feature-B: another feature - test
   8	feature-B: another feature that rox - test
   6	feature-A: a nifty feature - test
   0	: base - test
+  $ cd ..
+
+enable general delta
+
+  $ cat << EOF >> $HGRCPATH
+  > [format]
+  > generaldelta=1
+  > EOF
+
+
+
+  $ hg init alpha
+  $ cd alpha
+  $ echo 'base' > firstfile
+  $ hg add firstfile
+  $ hg ci -m 'base'
+
+  $ cd ..
+  $ hg clone -Ur 0 alpha beta
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ cd alpha
+
+  $ cat << EOF > A
+  > We
+  > need
+  > some
+  > kind
+  > of 
+  > file
+  > big
+  > enough
+  > to
+  > prevent
+  > snapshot
+  > .
+  > yes
+  > new
+  > lines
+  > are
+  > useless
+  > .
+  > EOF
+  $ hg add A
+  $ hg commit -m 'adding A'
+  $ hg mv A B
+  $ echo '.' >> B
+  $ hg amend -m 'add B'
+  $ cd ..
+
+Clone just this branch
+
+  $ cd beta
+  $ hg pull -r tip ../alpha
+  pulling from ../alpha
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  (run 'hg update' to get a working copy)
+  $ hg up
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.