Martin Vejnár avatar Martin Vejnár committed e1a699b

Allow depcommit only if there are no local modifications.

Comments (0)

Files changed (1)

             ui.write('R %s (%s %s)\n' % (dep.alias, dep.dest,
                 _readable_rev(alias.scmtype, dep.rev) if alias else dep.rev))
-def depcommit(ui, repo, nocommit, **commitopts):
+def depcommit(ui, repo, nocommit, force, **commitopts):
     '''save dependency state
     Update the .hgdeps file to reflect the current state of dependecies.
     The command will not work, if the working copy has either
     none or more than one parents.
+    if not nocommit and not force:
+        status = repo.status()
+        for part in status:
+            if part:
+                raise util.Abort(_('there are local modifications (use -f to override)'))
     manifest = _load_manifest(repo)
     deplist = []
     for item in manifest.itervalues():
             if not commitopts['message'] and not commitopts['logfile']:
                 commitopts['message'] = 'Updated dependency list for changeset %s' % rev[:12]
             mercurial.commands.commit(ui, repo, '.hgdeps', **commitopts)
+    else:
+        ui.note(_('no changes in the dependecy list\n'))
 def depalias(ui, repo, alias, location, type):
     '''bind an alias to a source location
         (depcommit, [
             ('C', 'nocommit', None, 'don\'t commit changes immediately'),
+            ('f', 'force', None, 'commit even in the presence of local modifications')
             ] + mercurial.commands.commitopts + mercurial.commands.commitopts2,
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
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.